SPUG: Thanks
Stuart Poulin
stuart_poulin at yahoo.com
Thu May 4 10:11:13 CDT 2000
You could use \Q\E multiple times: \Q(foo)\E$bar\Q*foo\E
But like Jim's RE pointed out, I don't like to get fooled by things like extra
spaces and tabs. So one thing I do once in a while is use the quotemeta()
function:
perl -e "print quotemeta q{something (I'm) trying to quote}"
(I'm on NT, if I was on Unix I'd suround it with single quotes.)
Then go through the output convert it to a RE by changing multiple "\ " to
"\s+", etc. Then I stuff in the ${variables} where I want them.
--- "Darren/Torin/Who Ever..." <torin at daft.com> wrote:
> Jay Scherrer, in an immanent manifestation of deity, wrote:
> >I had tried every other possible solution from using [string] and "string"
> for
> >that line. Yep it was was those pesky ()'s that did it.
>
> Remember that rather than special casing the []'s, use \Q...\E, they are
> most definitely your friends. About the only real problem with them are
> that you can't have a literal $ or @ in there. Oops.
>
> Darren
> --
> <torin at daft.com> <http://www.daft.com/~torin> <torin at debian.org>
> <torin at io.com>
> Darren Stalder/2608 Second Ave, @282/Seattle, WA
> 98121-1212/USA/+1-800-921-4996
> @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor
> @
> @ Make a little hot-tub in your soul. @
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
> Email to majordomo at pm.org: "action" spug-list your_address
>
>
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
Email to majordomo at pm.org: "action" spug-list your_address
More information about the spug-list
mailing list