Not sure what you're trying to do, but
if you wish to split into strings at
the pont ] or \] then just use the
split command to split at that string.
Put the string in an 'or' block, signified
in for perl regex engine as (a|b), where
both a and b represent a string, in your
case ] and \], though you'll have to 
escape that escape symbol (the \backslash\),
and the other command symbol, the right
square-bracket.

Hope that helps
lee

---------------------------------------------------
Lee Goddard: LBLtd: Perl/XML/Java/C Internet & AI
---------------------------------------------------
When your neighbour loses his job, it's a slump.
When you lose your job, it's a recession.
When an economist loses his job, it's a depression.

 

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Schiza, Apostolia (ISS Atlanta)
> Sent: 04 October 2001 17:36
> To: Perl-Win32 (E-mail)
> Subject: regex question
> 
> 
> 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
> 
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to