[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Problem with regular expression with Xquery

Newman, John W John.newman at viaoncology.com
Wed Feb 24 15:03:10 PST 2010


  Problem with regular expression with Xquery
Try putting parentheses around the last part and add a ?

[0-9]{3}\-[0-9]{3}(&P|P)?

? means 0 or 1 occurrence


From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Kenneth Dougherty
Sent: Wednesday, February 24, 2010 2:52 PM
To: http://x-query.com/mailman/listinfo/talk
Subject:  Problem with regular expression with Xquery

Hello,

The following problem has me stumped, and I would be grateful for any help.

I am using a regular expression to test if a document number is correct. The number can end with either 'P,' '&P,' or it may not have an ending value outside of the regular number.

For example, if a valid document number was 503-302, it could be 503-302P, 503-302&P, or just 503-302.

The incorrect regular expression so far is: [0-9]{3}\-[0-9]{3}&P|P.

This expression correctly finds 503-302P and 503-302&P, but of course fails to find 503-302. I've tried putting in other 'or' conditions at the end [e.g., |\s], but nothing has worked out.

Thank you again for your time and help.

Sincerely,

Kenneth Dougherty

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20100224/5d0affed/attachment-0001.htm


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.