For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > January 2006 > function or operator to ignore metacharacters like +









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author function or operator to ignore metacharacters like +
kelly

2006-01-10, 4:03 am

Hi,
I have this line that I have problem with..

s/$tmpvar//mgi;

The problem is sometimes $tmpvar = "annotationmarking +",
with metacharacters. Is there a regx option or perl function
that ignores metacharacter. Or should I go ahead and
parse my input for metacharacters and add a \ infront of it.

Thanks.

JP

Gunnar Hjalmarsson

2006-01-10, 4:03 am

kelly wrote:
>
> s/$tmpvar//mgi;
>
> The problem is sometimes $tmpvar = "annotationmarking +",
> with metacharacters. Is there a regx option or perl function
> that ignores metacharacter.


Yes.

perldoc perlre

perldoc -f quotemeta

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Paul Lalli

2006-01-10, 4:03 am

kelly wrote:

> I have this line that I have problem with..
>
> s/$tmpvar//mgi;
>
> The problem is sometimes $tmpvar = "annotationmarking +",
> with metacharacters. Is there a regx option or perl function
> that ignores metacharacter.


Yes. Read the relevant documentation on Regexps at
perldoc perlre
and search for \Q and \E

> Or should I go ahead and
> parse my input for metacharacters and add a \ infront of it.


No.

Paul Lalli

Jim Gibson

2006-01-10, 4:03 am

In article <43BAD575.3020507@some.com>, kelly <kelly@some.com> wrote:

> Hi,
> I have this line that I have problem with..
>
> s/$tmpvar//mgi;
>
> The problem is sometimes $tmpvar = "annotationmarking +",
> with metacharacters. Is there a regx option or perl function
> that ignores metacharacter. Or should I go ahead and
> parse my input for metacharacters and add a \ infront of it.
>
> Thanks.
>
> JP
>


You are posting the same messages independently to alt.perl and
comp.lang.perl. Please do not do that. I already wasted my time
responding to one of your posts in comp.lang.perl that was already
answered by Paul in alt.perl. If you must post to both groups, post one
message to multiple groups (cross-post).

And as I explained before, comp.lang.perl is defunct. Please do not
start threads there.

Thanks.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com