in reply to Re: Re: Substitute _last_ occurence in string?
in thread Substitute _last_ occurence in string?
$string =~ s/(.*)\s*two/$1/; That way, you'll catch it if it's the first characters in the string.
Update: Ok. Given the suggestions, How about:
$string =~ s/(.*)(^|\s+)two/$1/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re4: Substitute _last_ occurence in string?
by Hofmator (Curate) on Jul 25, 2001 at 19:22 UTC | |
|
Re: Re: Re: Re: Substitute _last_ occurence in string?
by carlitos (Acolyte) on Jul 26, 2001 at 14:39 UTC |