xsl-list
[Top] [All Lists]

Re: [xsl] Hanging regex

2012-11-17 12:04:38
On Sat, Nov 17, 2012 at 4:35 PM, Liam R E Quin <liam(_at_)w3(_dot_)org> wrote:
On Sat, 2012-11-17 at 12:05 +0000, Ihe Onwuka wrote:
First let me dissect the regex

         <xsl:analyze-string select="." flags="x"
                             regex="(.+?)
                                    ((-?\d*\s*)+$)"

Whenever you have a repeatable part in your regular expression that can
match the empty string, your regular expression processor takes one more
step down the staircase to the undocumented Tenth Circle.

Got it. A lesson for the ages.

David's solution set me on the right  track but was too permissive.
This is closer.
           <xsl:analyze-string select="." flags="x"
                               regex="(.+?)\s+
                                      ((-\s*|-?\d+\s*)+$)"

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>