Re: regular expression for string substitution

From: Dave (drossign_at_akamai.com)
Date: 07/30/04


Date: 30 Jul 2004 05:29:39 -0700

Paul,

Thanks for the input. I couldn't quite figure out what the script was
doing. It was a modified version of a script originally written by
Larry Wall so I just took Larry's original script and used that
instead. Escaping the . and ? worked great so now I am in business.

Dave

Paul Lalli <mritty@gmail.com> wrote in message news:<20040729145752.K3404@barbara.cs.rpi.edu>...
> On Thu, 29 Jul 2004, Dave wrote:
> >...snip...
>
> Looking at your output, I'd have to guess you used the transliteration
> operator tr/// or y/// rather than the substitute operator s///. Your
> pattern is almost correct, but you need to escape the . and the ?.
>
> $filename =~ s/\.cfm\?id=/_/;
>
> If you're just passing the pattern to some other script, I'd suggest you
> take a look at that script to see what it's doing. Again, it should be
> using s///, not tr/// or y///
>
> Paul Lalli



Relevant Pages