On Sun, 31 Oct 1999, Chris M wrote:
> I'd like to strip leading characters including \ for users that are
> using NT Domains and don't understand what they are doing on dialup :)
>
> So WORKGROUP\myname should be rewritten to myname.
Off the top of my head....
RewriteUsername s/^.*\\(.*)/$1/
And if you insist on stripping the (nonexistant or incorrect) trailing
spaces as well....
RewriteUsername s/^.*\\(.*)\s*$/$1/
> Here is what I have so far, this might be helpful to others also:
>
> <Realm mydomain.com>
> # Strip leading white space
> RewriteUsername s/^\s+//
> # Strip trailing white space
> RewriteUsername s/\s+$//
> # turn into lowercase and chop domain
> RewriteUsername tr/A-Z/a-z/
> RewriteUsername s/^([^@]+).*/$1/
> # attempt to strip leading \ and characters up to it (no workee, help)
> RewriteUsername s/^(\\+).*//
Remember that Regex matching in general (and RewriteUsername in specific)
is slooowwwwww. You certainly want to cut down on the number of rewrite
statements. For example, the first two you list could be done with one
regex... "s/^\s*(.*)\s*$/$1/". On the other hand, I'd first make sure
that you need to do that anyway; I've never seen leading and trailing
spaces coming in on the username field, so that'd just be slowing it down
for nothing in my case. In any case, both of the ones I tossed out at
the top will strip leading spaces, and the second will strip trailing
spaces (of course, only if a "\" is in the string to begin with).
I'd suggest something like this for what you appear to want:
# rewrite domain\username to username
RewriteUsername s/^.*\\(.*)/$1/
# rewrite username@domain to username
RewriteUsername s/^(.*)\@.*/$1/
# promote user lameness and increase security risks
RewriteUsername tr/[A-Z]/a-z/
Please note I just wrote these regex's off the top of my head, so they
may have typos or something odd wrong with 'em....none of my regex's
have ever worked the first time around....buuuut, you should be able
to see the thinking behind 'em, expecially armed with that nice O'Rielly
book. (:
===
Archive at http://www.thesite.com.au/~radiator/
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.