469,327 Members | 1,226 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Regular Expression Help

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
2 1636
Thank you all. I've solved the problem.

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

Thanks,

Robert
Aug 29 '06 #2
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.

Similar topics

7 posts views Thread by Reckless | last post: by
5 posts views Thread by Ian Richardson | last post: by
6 posts views Thread by JohnSouth | last post: by
6 posts views Thread by dotnetprogram | last post: by
9 posts views Thread by Schorschi | last post: by
3 posts views Thread by rodchar | last post: by
3 posts views Thread by Zach | last post: by
14 posts views Thread by Chris | last post: by
9 posts views Thread by Rene | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.