[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to escape the normal interpretation of parent

Subject: Re: How to escape the normal interpretation of parentheses when utilizing regex-group()?
From: "Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 May 2023 13:05:08 -0000
Re:  How to escape the normal interpretation of  parent
DC>  something like
DC> ^\s*([0-9]+(\s+thru\s+[0-9]+)?)\s*(.*)$

I can report that not only is something like this what I would do, it is what
I have done, although my case was mildly different (e.g., the \s+thru\s+ was
just an en dash). But note that (at least in my case where the 2nd desired
output field was always present) the whitespace separator immediately before
the last group should probably be required, not optional. (Given that the
match in front of it is only digits, it is not going to really to matter. But
it makes it clearer what the regex is doing, IMHO, especially when either the
3rd group might start with digits or the 1st group might have roman numerals
or some other stuff that looks more like the 3rd group.) Also may be useful to
trim off trailing whitespace. Thus
  ^\s*([0-9]+(\s+thru\s+[0-9]+)?)\s+(.+)\s*$
and pick off the 1st group for <column> and the 3rd group for <field-name>.
(Although in truth, IIRC I did not bother with the trim trailing whitespace
\s* at the end, and passed the matched fields through normalize-space()
instead  I think I did not entirely trust the 3rd group to be consistent
about whitespace. But thats not really germane for the overall methodology of
nesting group 2 in group 1, and parsing off groups 1 & 3.)

________________________________

Current Thread

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.