[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [curn-users] how to escape forward slash in regExp?
On 10/09/06 12:43, Mark Fletcher wrote:
> Hi Brian,
>
> I'm trying to use EditFeedURL and I need to use forward slashes in my
> replacement string. I'm trying to do something like this:
>
> 's/&/\/IssueNavigator/'
>
> (append "/IssueNavigator" to existing url)
>
> but the parser keeps interpreting the first escaped forward slash as
> the end of the replacement string and then gives an error about an
> "unknown modifier 'I'. Am I wrong in thinking that a backslash should
> be used to escape reserved characters?
That's a "bug" (or, more correctly, a "lack of feature") in the
substitution parser; it doesn't honor escapes.
But, regardless, a better, more readable solution is to use a different
delimiter, something other than "/". For example:
's|$|/IssueNavigator|'
Note, too, that you want to use a "$", not an "&", to denote "end of line"
in the regular expression.
--
-Brian
Brian Clapper, http://www.clapper.org/bmc/
Wagner's music is better than it sounds.
-- Mark Twain
---
*** Posted to the curn-users mailing list (curn-users@xxxxxxxxxxx).
Back to curn-users archive.