Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

BBS: Re: Perl string manipulation - September 18, 1998 at 12:48:43

You are here: irt.org | BBS | Re: Perl string manipulation [This BBS is closed]

Posted by Jason Nugent on September 18, 1998 at 12:48:43:

In Reply to: Re: Perl string manipulation posted by Jason Turner on September 18, 1998 at 12:29:33:

: : : $pish =~ s/| (\w+)|$/$1/;
: : : $pish =~ s/\|\w+\|\+-+\+\| (\w+?)\|$/$1/;

: : : I get the exact same string in the variable. Any other ideas?

: Bob, how many more do you want ?
: I gave you 10 that all worked.

: : Really? This the code I used to test it: Try this:

: : $string = '|password|+----------+|rangers|';

: Jase, dunno what browser you're using, but on mine the orig string had a space after "rangers" :)
: I think that's why it's not working for Bob.

: BTW, I'd steared clear of the \w match coz there are so many chars used in passwords that it wouldn't hit.

: My expressions were generic "split on some delimeter" solutions.

A space?? Man... sorry about that. Ok, I didn't see it :)

Good point about the password field. This all comes back to knowing your data. Instead of using a \w+ (which matches alphanumerics), you might consider using a [^\|]+ instead, which should match everything except |. Or just make your users use bad passwords :)

Jason



Follow-ups:

You are here: irt.org | BBS | Re: Perl string manipulation [This BBS is closed]

©2018 Martin Webb