On Sun, 31 Oct 1999, Chris M wrote:

>I have figured out most of what I want to do in this regard.
>
>But...
>
>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.
>
>I bought the RegEx book from O'Reilly to give this a shot.  Anyone 
>have any hints to get me on the tracks?
>
>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/^(\\+).*//

This expression would be read like this:

- Substitue anything that:
  - Starts with one or more backslashes, remembering all the backslashes.
  - Ends with anything else.
- With:
  - Nothing.

Fisrt off, the parentheses serve no function here.  They are used to
remember part of the matching expression in the $1, $2.. variables, but
these variables are not used on the *right* hand side, so, it gets chucked
out anyways.

I think what you meant to do was this:

RewriteUsername s/^.*\\(.*)/$1/

This will read like this:

- Substitute anything that:
  - Starts with any amount of any characters, as long as
  - The characters are followed by a backslash.
  - And match anything after that, storing it in the first memorization
variable ($1).

- With:
  - The contents of the first memorization variable $1.


Note that the regular expressions used in Radiator are actually not the
'standard' UNIX regular expressions; rather, they are Perl's.  A good
description can be found in chapter 2 of O'Reilly's 'The Perl Language',
also known as the Camel book.

===========================================================
David M. Lloyd                  mailto:[EMAIL PROTECTED]

Administrator
Internet Express, Inc.
802 W. Broadway, Suite 0101
Madison, WI. 53713-1866
Voice: (608) 663-5555           http://www.inxpress.net
Fax: (608) 663-5595             mailto:[EMAIL PROTECTED]
Data: (608) 663-5551            mailto:[EMAIL PROTECTED]

===========================================================


===
Archive at http://www.thesite.com.au/~radiator/
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to