I've been using expressions such as
<xsl:variable name="prefix" select='"(^|\W)"'/>
<xsl:variable name="suffix" select='"($|\W)"'/>
<xsl:variable name="pattern" select="concat($prefix,$property,$suffix)"/>
Notice that
a) the hyphen is included in the set of stoppers, and
b) that you have to handle the cases °word$, \Wword$, ^word\W and
\Wword\W separately so as to not lose a character matching the \W.
I think that the hyphen can be excluded by a character class
subtraction, but I'll have to study the syntax some more.
-W
On 8 April 2011 13:21, Dave Pawson <davep(_at_)dpawson(_dot_)co(_dot_)uk> wrote:
On Fri, 08 Apr 2011 11:47:18 +0100
David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
On 08/04/2011 11:11, Dave Pawson wrote:
I really couldn't contemplate writing such a regex to be honest
David.
if you have a whitespace list of words then the regex is
string-join(tokenize($list,'\s+'),'|')
is that so hard to contemplate?
or you could, as Wolfgang just commented, try to give the regex
engine a helping hand by pre-optimizing that regex by pulling out
common prefixes.
David
With Wolfgangs notes, I'm struggling with the regex for one.
<xsl:analyze-string select="."
regex="[^a-z]({$property})[\s.,",'<$]">
Is currently missing >keyword ....
and
... keyword<....
Since checking for frisbee (where bee is the keyword)
causes >bee .... to be missed.
Ditto with the termination? I'm 'requiring'
a termination, hence missing bee</element
How to add ^ and $ to the start and termination classes?
regards
--
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--