By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

Regular Expression Help

P: 3
I'm using a proprietary version of Netscape's Server Side JS engine and I'm having trouble with a regular expression parsing correctly.

I have a string "U.costcenterid IN (1241,1242,1243)" that I need to pull the "U.costcenterid" out as back reference 1 and "1241,1242,1243" as back reference 2. This comma delimited list may have one or dozen comma delimited numbers in it.

This RE works, but also matches letters as well as numbers:
\w+\.(\w+)\s+IN\s+\((.+,?)\)

What I really need is for it to match only numbers. I've tried \w+\.(\w+)\s+IN\s+\((\d+,?)\), but this fails to match.

I suspect it has to do with my comma placement, but I've spend much of the last day working on this and really need to be able to move on.

Any help would be greatly appreciated.

Thank you.

Robert
Aug 29 '06 #1
Share this Question
Share on Google+
2 Replies


P: 3
Thank you all. I've solved the problem.

The solution was "\w+\.(\w+)\s+IN\s+\((\d+,?)+\)".

Thanks,

Robert
Aug 29 '06 #2

P: 3
Oops, the actual solution was

\w+\.(\w+)\s+IN\s+\(((\d+,?)+)\)
Aug 29 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.