Subject: Re: [xsl] Escaping Characters in replace() From: Ivan Shmakov <oneingray@xxxxxxxxx> Date: Tue, 15 Oct 2013 17:08:15 +0000 |
>>>>> Nathan Tallman <ntallman@xxxxxxxxx> writes: [b&] > Why didn't you need to escape the period in the third argument of > replace ()? (When I insert one, my processor throws an error; so, I > understand it's wrong, but not why. The second argument to replace () is a regular expression of the flavor that uses b.b to denote bany character.b (The regular expression to match a literal period is produced by bescapingb such a special character with a b\b, thus forming b\.b.) On the contrary, the replacement string is not a regular expression, b.b (as well as a number of other characters) is always taken literally there, and needs no escaping whatsoever. Moreover, I guess that b\b plays its own, different role there. (Ibm not exactly familiar with XPath versions other than 1.0.) > Also, I seem to be able to delete the backslash in front of the > period in the second argument without causing problems... Why is > that?) The probable cause is that the source text doesnbt contain any sequences of the form b(any character other thanb.bb)b("b) in the context replace () is applied to. Otherwise, these would also be replaced with b(".b), as in: Source: <unittitle>"Mary had a little lamb"</unittitle> Result: <unittitle>"Mary had a little lam."</unittitle> -- FSF associate member #7257
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Escaping Characters in re, Nathan Tallman | Thread | Re: [xsl] Escaping Characters in re, Ivan Shmakov |
Re: [xsl] Escaping Characters in re, Nathan Tallman | Date | Re: [xsl] Escaping Characters in re, David Carlisle |
Month |