Normalizing usernames from printer usage

KB Home   |   Normalizing usernames from printer usage

Main.NormalizingUsernamesFromPrintUsage History

Hide minor edits - Show changes to output

August 20, 2019, at 05:09 AM by peterf - Fixing summint' minor
Changed line 57 from:
^([^\s]+)
to:
   ^([^\s]+)
August 20, 2019, at 05:07 AM by peterf - Added a new example for stripping IP address suffix sometimes seen with LPD / LPR printing
Deleted lines 38-39:

Added lines 53-58:
!!! Example 5

Some environments using the LPD / LPR print protocol may see print jobs arriving with IP addresses suffixed to usernames, e.g. @@jsmith (192.168.4.20)@@. The following regex will extract the username which appears prior to the whitespace character, excluding said whitespace character and the IP address that follows.

^([^\s]+)

Changed line 62 from:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalisation, username normalisation -]
to:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalisation, username normalisation, Unix, LPD, LPR, SAP -]
Changed lines 3-4 from:
On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to [[https://www.papercut.com/ | PaperCut]].  The print usage will then be tracked against the full context username rather than the standard username  (e.g. jsmith).
to:
On some systems, when users print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to [[https://www.papercut.com/ | PaperCut]].  The print usage will then be tracked against the full context username rather than the standard username  (e.g. jsmith).
Changed line 58 from:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalization -]
to:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalisation, username normalisation -]
Changed line 56 from:
''Categories:'' [[Category.Users|+]], [[Category.PaperCutNG|+]]
to:
''Categories:'' [[Category.Users|+]]
Changed lines 15-16 from:
Regular expressions are a powerful way to search text, however they can be quite complicated, so some example have been listed below.  For more information regular expressions see the [[http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#construct | Regular expression syntax reference]] and the [[http://www.regular-expressions.info/ | Regular expression tutorial]].
to:
Regular expressions are a powerful way to search text, however they can be quite complicated, so some example have been listed below.  For more information regular expressions see the [[http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#construct | Regular expression syntax reference]] and the [[http://www.regular-expressions.info/ | Regular expression tutorial]].  There is even an online regular expression tester available [[http://www.fileformat.info/tool/regex.htm | here]].
Changed lines 5-7 from:
PaperCut NG can be configured to extract the username component of the full username with context.  To do this:

# Log into the PaperCut NG admin pages
to:
PaperCut can be configured to extract the username component of the full username with context.  To do this:

# Log into the PaperCut admin pages
Changed lines 55-59 from:


''Categories:'' [[!Users]], [[!PaperCutNG]]

[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalization -]
to:
----
''Categories:'' [[Category.Users|+]], [[Category.PaperCutNG|+]]
----
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalization -]
Changed line 59 from:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise -]
to:
[-Keywords: Novell Netware NDPS iPrint eDirectory normalise, normalization -]
Changed lines 15-16 from:
Regular expressions are a powerful way to search text, however they can be quite complicated, so some example have been listed below.  For more information regular expressions see the [[http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#construct | Regular expression syntax reference]].
to:
Regular expressions are a powerful way to search text, however they can be quite complicated, so some example have been listed below.  For more information regular expressions see the [[http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#construct | Regular expression syntax reference]] and the [[http://www.regular-expressions.info/ | Regular expression tutorial]].
Changed lines 49-56 from:
to:
!!! Example 4

To filter usernames that appear ''both'' like @@.jsmith.dept.orgname@@ ''OR'' @@jsmith\DEPT\ORGNAME@@  use the following regex:

    ^\.?([^\.\\]+)


March 05, 2007, at 10:57 PM by matt - add another regex example
Deleted lines 28-29:

Added lines 31-42:
Novell networks often set the print usersname to something like: @@.jsmith.dept.orgname@@ (note the leading @@.@@ character).

To filter username like @@.jsmith.dept.orgname@@ and extract the username @@jsmith@@ user the following regex:

    ^\.([^\.]+)

In words this means: from the start of the string, match a single @@.@@, then match and extract one or more characters, as long as the character is not a @@.@@ (period / full-stop). So this matches everything up to the first @@.@@ character.



!!! Example 3

Changed lines 3-4 from:
On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to [[http://www.papercut.biz/ | PaperCut].  The print usage will then be tracked against the full context username rather than the standard username  (e.g. jsmith).
to:
On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to [[http://www.papercut.biz/ | PaperCut]].  The print usage will then be tracked against the full context username rather than the standard username  (e.g. jsmith).
Changed lines 3-4 from:
On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to PaperCut.  The print usage will then be tracked against this user rather than the username  (e.g. jsmith).
to:
On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to [[http://www.papercut.biz/ | PaperCut].  The print usage will then be tracked against the full context username rather than the standard username  (e.g. jsmith).
Added lines 1-42:
(:title Normalizing usernames from printer usage :)

On some systems, when user's print their username contains the full context of their name in the domain.  An example of where this occurs is when using Novell's print services.  In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to PaperCut.  The print usage will then be tracked against this user rather than the username  (e.g. jsmith).

PaperCut NG can be configured to extract the username component of the full username with context.  To do this:

# Log into the PaperCut NG admin pages
# Go to the '''Options''' tab
# Press the '''Config Editor (Advanced)''' actions link on the left.
# Search for the @@system.normalize-network-username-regex@@ config key.
# Enter the regular expression to filter the username and press the '''Update''' button next to the value.  For example regular expressions, see below.

!! How Username Filter Regular Expressions Work

Regular expressions are a powerful way to search text, however they can be quite complicated, so some example have been listed below.  For more information regular expressions see the [[http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#construct | Regular expression syntax reference]].

The username filter extracts the username from the first matching regular expression group.  A regular expression group is surrounded by parenthesis. e.g. @@()@@.  So the component of the regular expression that matches the username should be surrounded in parenthesis.

!! Example Regular Expressions

!!! Example 1

To filter username like @@jsmith.dept.orgname@@ and extract the username @@jsmith@@ user the following regex:

    ^([^\.]+)

In words this means: from the start of the string, match and extract one or more characters, as long as the character is not a @@.@@ (period / full-stop). So this matches everything up to the first @@.@@ character.



!!! Example 2

To filter username like @@prefix.jsmith.dept.orgname@@ and extract the username @@jsmith@@ user the following regex:

    ^prefix\.([^\.]+)

In words this means: from the start of the string, match @@prefix.@@, then match and extract one or more characters, as long as the character is not a @@.@@ (period / full-stop). So this matches everything between @@prefix.@@ up to the first @@.@@ character.


''Categories:'' [[!Users]], [[!PaperCutNG]]

[-Keywords: Novell Netware NDPS iPrint eDirectory normalise -]

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on August 20, 2019, at 05:09 AM
Printable View   |   Article History   |   Edit Article