[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] analyze-string help?

Subject: [xsl] analyze-string help?
From: Dan Vint <dvint@xxxxxxxxx>
Date: Sat, 09 Jun 2012 22:40:24 -0700

I have the following value in the $title variable without the quotes
"foo-119 Mode Module Batteries - Installation"

I have a series of strings like this where I want to separate the content after the last "space dash space" from everything the proceeds that point. So I came up with the following:

<xsl:analyze-string select="$title" regex="([A-Za-z0-9 -,./]*) - ([ A-Za-z0-9/]*)">
<techname><xsl:value-of select="regex-group(1)"/></techname>
<infoname><xsl:value-of select="regex-group(2)"/></infoname>
<xsl:comment>NO MATCH for techname and infoname "<xsl:value-of select="$title"/>"</xsl:comment>

I'm getting this output:

<!--NO MATCH for techname and infoname "foo-119 Mode Module Batteries - Installation"-->
<techname>119 Mode Module Batteries</techname>

I was expecting all dashes to be captured except for the last one or at least the first "space dash space", it looks like the pattern gets the "foo-" and flags it as mismatched and then captures the other two strings. Can you help me understand what is going on.


Danny Vint

Panoramic Photography

voice: 619-938-3610

Current Thread