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
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 y
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 ( )
{
if( $_ =~ m/(.*)\\\]/