Try doing a NON-greedy search by putting a ? After your selector:
REReplaceNoCase(
inputxml,
"<text[^>]*>(.*?)<\/text>",
"",
"ONE"
)
Notice, (.*?) this should match the shortest possible string.
......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
Need ColdFusion Help?
www.bennadel.com/ask-ben/
-----Original Message-----
From: Markus Weber [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 05, 2006 9:21 AM
To: CF-Talk
Subject: Replace content between tags (REReplaceNoCase)
Hello guys,
i have a problem with the following regex:
REReplaceNoCase(inputxml,"<text[^>]*>(.*)<\/text>","")
The regex should replace the tag <text> with all the content inside
(even other tags). It works fine if only one <text>...</text> is in the
whole string. But if theres a second or a third the replace works wrong.
Example String that works right:
"bla bla bla <text>bla bla <b>bla</b>bla</text> bla bla bla"
Example String that works false:
"bla bla bla <text>bla bla <b>bla</b>bla</text> bla bla bla <text>bla
bla <b>bla</b>bla</text>"
The replace will start at the first <text> and does end at the very last
</text> at the end of the string.
Does anyone have a idea how i have to optimize my expression?
Greets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262887
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4