xsl-list
[Top] [All Lists]

RE: problem with replace()

2005-11-21 07:13:48
I would suggest splitting the string into words using xsl:analyze-string and
then applying replace to each of the words.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: UlyLee [mailto:ulyleeka(_at_)yahoo(_dot_)com] 
Sent: 21 November 2005 12:50
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] problem with replace()

Hi!

I have this tiny problem regarding replace() and
matches(). i have a search string like "traits dunion"
and a source string like "illtraits dunions", if i run
replace("illtraits dunions", "traits dunion", "rep1")
the result woul be "illrep1s".

But i want my replace function to replace strings when
the character before the search string is a space, a
valid punctuation or a start of the string while the
character that appears after the serach string is a
space or a valid character.

ex:

illtraits dunions ---> should not be replaced
ill traits dunions ---> should not be replaced
ill traits dunion s ---> ill rep1 s
ill "traits dunion" s ---> ill "rep1" s
ill (traits dunion) s ---> ill (rep1) s
ill"traits dunion"s ---> should not be replaced

what regular expression can i use of replace or
matchcs so that i can match this type of pattern?

thanks,
UlyLee


              
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.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>
--~--





--~------------------------------------------------------------------
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>