[Israel.pm] RegEx question

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Tue Mar 5 08:26:54 PST 2013


Thanks Pinkhas

> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
> Behalf Of Pinkhas Nisanov
> Sent: Tuesday, March 05, 2013 2:17 PM
> To: Perl in Israel
> Subject: Re: [Israel.pm] RegEx question
> 
> use look-ahead, e.g.:
> 
> my $str1 = "abc /* sdfkjhl";
> my $str2 = "abc /* sdfkjhl */";
> 
> chkre( $str1 );
> chkre( $str2 );
> 
> sub chkre {
>   my ($str) = @_;
>   if ($str =~ m|/\*(?!.*\*/)|)
>     {
>       print "MATCHED: $str\n";
>     }
>   else
>     {
>       print "DOES NOT MATCHED: $str\n";
>     }
> }
> 
> output:
> 
> MATCHED: abc /* sdfkjhl
> DOES NOT MATCHED: abc /* sdfkjhl */
> 
> 
> thanks
> Pinkhas Nisanov
> 
> 
> 
> On Tue, Mar 5, 2013 at 1:20 PM, Yossi Itzkovich
> <Yossi.Itzkovich at ecitele.com> wrote:
> >
> > Hi,
> >
> >
> >
> > I have a (simple) regex question that I don't remember how to do it
> > efficiently:  I want to find all lines that have a starting of a C
> comment,
> > but have no end of that comment at the rest of the line.
> >
> > For example:
> >
> >
> >
> > Abcdefg /* I want to match this line
> >
> > Abcdefg /* I don't want to match this line */
> >
> >
> >
> > How can it be done in one pattern ?
> >
> >
> >
> > Regards,
> >
> > Yossi
> >
> >
> >
> >
> >
> > This e-mail message is intended for the recipient only and contains
> > information which is CONFIDENTIAL and which may be proprietary to ECI
> > Telecom. If you have received this transmission in error, please
> inform us
> > by e-mail, phone or fax, and then delete the original and all copies
> > thereof.
> >
> >
> > _______________________________________________
> > Perl mailing list
> > Perl at perl.org.il
> > http://mail.perl.org.il/mailman/listinfo/perl
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl


This e-mail message is intended for the recipient only and contains information which is CONFIDENTIAL and which may be proprietary to ECI Telecom. If you have received this transmission in error, please inform us by e-mail, phone or fax, and then delete the original and all copies thereof.



More information about the Perl mailing list