----- Original Message -----
From: Dave Kitabjian <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 16, 2000 11:46 PM
Subject: (RADIATOR) stripping spaces off username


> We have a surprising number of "No such user" failures which appear to
be
> caused by leading or trailing spaces around the username. In Unix, I
would
> fix this as:
>
> echo "  dave   " | sed -e 's/^ *//' -e 's/ *$//'
>
> Since I don't know perl, I'm not sure how to test this without going
live,
> so I was wondering if someone could confirm the proper perl/radiator
> syntax. My guess is:
>
> RewriteUsername  s/^ *//
> RewriteUsername  s/ *$//
>
> Is this correct? Thanks all! (Btw, how *would* I test this with perl?)
>
no, it's not quite correct.
it should be:

RewriteUsername s/^ //
RewriteUsername s/ $//

a simple little perl script to test your regexes would be something like
the following:

#!/usr/bin/perl -w

$regex1 = '^ ';
$regex2 = ' $';
$username = ' someusernamewithspaces ';
$username =~ s/$regex1//;
$username =~ s/$regex2//;
print "Username: '$username'\n";

and it should print out the following:

Username: 'someusernamewithspaces'

hope this helps :)
---
Joel Michael
System Administrator

Diggy Internet Services
90 Petrie Terrace
Brisbane Qld 4000
Australia

Ph: +61 7 3367 3555
Fax: +61 7 3367 3544
Mob: 0401 039 462


===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to