[ILUG] Perl regex question
waider at waider.ie
Fri Oct 25 14:36:06 IST 2002
On October 25, Rory.Winston at telewest.co.uk said:
> I have a question re: a regex that has had me stumped. I have a CGI script
> that generates a string of concatenated user ids, such as "1|2|86|907|7|"
> etc. I had a regex that extracts the uids like so:
> print("id=$1\n") while ( $id_string =~ /(\d+)|/g );
The pipe character has special meaning in regular expressions. Here,
you're asking for "A set of digits or an empty string". You might also
want to look at the split() function, which may be more suited to your
waider at waider.ie / Yes, it /is/ very personal of me.
"The things you do are, more or less, wrong.
The mistakes you do are, more or less, always the same.
Sell your earrings, dance the director's ballade." - Andrea.B.Previtera
More information about the ILUG