List Info

Thread: Re: Problem while matching a string




Re: Problem while matching a string
country flaguser name
United States
2007-05-31 19:06:37

--- In perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com, "yaswanth krishna"
<yaswanth.krishna...> wrote:
&gt;
> Hi..
>;
> I had a problem while using regex containing scalar
variable(consisting of
> one paranthesis)..
>; Can anyone tell me how to handle this..
&gt;
> It is considering that paranthesis as closing paranthesis for "if
> condition&quot;.
&gt;
> >perl -e '$a = "asdasd)"; $b =asda; if( $b =~ /$/ ){ print
&gt; "matchn"; }'
> /asdasd)/: unmatched () in regexp at -e line 1.
>
> Is there any option while matching regex to consider metacharacters as
> normal characters..
>
>
> Thanks
&gt; Krishna..
>
>
> [Non-text portions of this message have been removed]
>

yes just escape them with a back slash , thus to check for ")&quot; use ")&quot;

if( $b =~ /$)/ ) { print etc...}

Greg

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )