[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

regular expression in replace()

Subject: regular expression in replace()
From: UlyLee <ulyleeka@xxxxxxxxx>
Date: Tue, 18 Oct 2005 04:51:30 -0700 (PDT)
regular expression and replace
I have a string: "Lucie et Suz. Beauvais Suzanne" and
i want to replace "Suz." with "Suzanne".

but when i use replace("Lucie et Suz. Beauvais
Suzanne","Suz.","Suzanne") it gives me "Lucie et
Suzanne Beauvais Suzannenne", i figured that this is
because "." is treated as a regular expression thats
why it replaced "Suza" with "Suzanne". I know i need
to escape the "." to  "\." but what if my
replace-pattern contains other regex characters like
"?" "*" "+"?

Michael Kay suggested that i first make my replacement
string to regelar expression or create a replace
function that uses substring-before() and contains().
How am i to go around this? I'm just starting out in
XSL and the new features of XSLT 2.0 sometime confuses
me.

My first alternative was to use replace($sourceStr,
".", "\.") but it says "\." is an invalid replacement string.


		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.