my @strings = qw( hello\] hi_there] how_are_you2\] fine-and-you\]
good_thanks]);

for(@strings){
  my $matched = /(.*)\\*?\]$/;
  if( $matched )
  {
          print "matched! - $1 \n"
  }
  else
  {
          print "no match -  $1 \n"
  }
}

matched! - hello\
matched! - hi_there
matched! - how_are_you2\
matched! - fine-and-you\
matched! - good_thanks


On Thu, 4 Oct 2001, Schiza, Apostolia (ISS Atlanta) wrote:

> hello all,
> I need some help with regex again...
> 
> I have a file that looks like this:
> 
> hello\]
> hi_there]
> how_are_you2\]
> fine-and-you\]
> good_thanks]
> 
> I need my regex to much all these strings above.
> The only way now that I can do this is by having 2 regex :
> while ( <FILE>)
> {
>       if( $_ =~ m/(.*)\\\]/ or $_ =~ m/(.*)\]/ )
>       {
>               print "matched! - $1 \n"
>       }
>       else
>       {
>               print "no much -  $1 \n"
>       }
> }
> 
> I tried this regex:
> $_ =~ m/(.*)[\\\]|\]]/
> 
> but it will returns 
> $1 = hello\
> $1=how_are_you2\
> $1=fine-and-you\
> 
> I need to get rid off of this '\' at the end!
> 
> Thanks!
> 
> -Lia-
> 
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
> 

-- 
Sincerely,
Mick Ghazey
201.444.1343



_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to