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
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!