Use

s'#4'Blah hash $288'gi

This treats the replacement string as single quoted and avoids variable
interpolation.  Adding quotemeta in your case won't do it because the
variable interpolation happens first:

s/#4/\QBlah hash $288/gi

gives you

End of the line Blah\ hash\


Patrick McCabe

----- Original Message -----
From: Bob Tanner <tanner at real-time.com>
To: <tclug-devel at lists.real-time.com>
Sent: Wednesday, June 20, 2001 3:26 AM
Subject: Re: [TCLUG-DEVEL] Perl guru and regex?


> Quoting Bob Tanner (tanner at real-time.com):
> > I want to do a substitution like this:
> >
> > s/#4/Blah hash $288/gi
>
> I guess a better question what is a quick and easy was to escape all
> meta-characters in a string?
>
> Like, if I want to escape * ? $
>
> --
> Bob Tanner <tanner at real-time.com>       | Phone : (952)943-8700
> http://www.mn-linux.org                 | Fax   : (952)943-8500
> Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9
>
> _______________________________________________
> tclug-devel mailing list
> tclug-devel at mn-linux.org
> https://mailman.mn-linux.org/mailman/listinfo/tclug-devel
>