function or operator to ignore metacharacters like +

function or operator to ignore metacharacters like +

am 03.01.2006 20:48:52 von kelly

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

Re: function or operator to ignore metacharacters like +

am 03.01.2006 21:11:22 von Gunnar Hjalmarsson

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

Re: function or operator to ignore metacharacters like +

am 03.01.2006 21:23:58 von Paul Lalli

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

Re: function or operator to ignore metacharacters like +

am 03.01.2006 22:33:25 von Jim Gibson

In article <43BAD575.3020507@some.com>, kelly 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