LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Perl regex question

[ILUG] Perl regex question

Ronan Waide waider at waider.ie
Fri Oct 25 14:36:06 IST 2002


On October 25, Rory.Winston at telewest.co.uk said:
> Hi
> 
> 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
purposes.

Cheers,
Waider.
-- 
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 mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell