[prev in list] [next in list] [prev in thread] [next in thread]
List: xsl-list
Subject: Re:=?UTF-8?B?wqA=?=[xsl] Need an XPath expression which returns all xs:pattern elements containing a
From: "Roger L Costello costello () mitre ! org" <xsl-list-service () lists ! mulberrytech ! com>
Date: 2024-04-04 15:46:47
Message-ID: 20240404114619.f5d5bb64 () lists ! mulberrytech ! com
[Download RAW message or body]
David Carlisle devised a brilliant approach:
Do a series of replace operations:
remove all whitespace:
replace(@value,'\s','')
replace \-quoted characters by x:
replace(@value,'\\.','x')
replace {99,} constructs by *
replace(@value,'\{[0-9]+,\}','*')
Here are the replaces, inlined:
replace(replace(replace(@value,'\{[0-9]+,\}','*'),'\\.','x'),'\s','')
Here are the results of applying the replaces to some regexes:
A* --> apply replaces --> A*
A+ --> apply replaces --> A+
A\* --> apply replaces --> Ax
A\+ --> apply replaces --> Ax
A{0,} --> apply replaces --> A*
A{1,} --> apply replaces --> A*
A{5,} --> apply replaces --> A*
\\* --> apply replaces --> x*
To implement "Find all xs:pattern elements that permit an unbounded number of characters" do this:
If the string resulting from applying the replaces
contains * or +, then the regex permits an
unbounded number of characters.
David (or anyone), is this correct?
/Roger
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/651070
or by email: xsl-list-unsub@lists.mulberrytech.com
--~--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic