S
Sparticus
I am a stupid project due tomorrow and I am dying over a simple regular
expression.
I have the string :
$blah = "123;456;789;abc;def;ghi";
and all I want to do is remove anything at the end of the string up to
and include the semi-colon.
so I want to end of with :
$blah = "123;456;789;abc;def";
how is this done? I know I need the nongreedy stuff here... this is
what I tried and nothign seems to work :
$blah =~ s/;.*?$//;
$blah =~ s/\;.*?$//;
$blah =~ s/;(.*)?$//;
$blah =~ s/;?.*$//;
$blah =~ s/(;.*)?$//;
Nothing seems to work.... I need getting empty strings or at best I get
:
$blah = "123";
Anyone? I am going crazy here!....lol
Thanx
expression.
I have the string :
$blah = "123;456;789;abc;def;ghi";
and all I want to do is remove anything at the end of the string up to
and include the semi-colon.
so I want to end of with :
$blah = "123;456;789;abc;def";
how is this done? I know I need the nongreedy stuff here... this is
what I tried and nothign seems to work :
$blah =~ s/;.*?$//;
$blah =~ s/\;.*?$//;
$blah =~ s/;(.*)?$//;
$blah =~ s/;?.*$//;
$blah =~ s/(;.*)?$//;
Nothing seems to work.... I need getting empty strings or at best I get
:
$blah = "123";
Anyone? I am going crazy here!....lol
Thanx