[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [curn-users] how to escape forward slash in regExp?



Beautiful! That solved it.

Thank you.

--- Brian Clapper <bmc@xxxxxxxxxxx> wrote:

> 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).
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
---
*** Posted to the curn-users mailing list (curn-users@xxxxxxxxxxx).



 Back to curn-users archive.