
November 20th, 2012, 03:09 AM
|
|
|
Hi,
this is how I would do it in Perl:
or (using parens or semi-colon as separator rather than / to avoid escaping):
Code:
s(/[^_\/]*_)(/)g;
or
s;/[^_\/]*_;/;g;
For example, if you have the following string: "/foo/bar_baz/", these regexes will return this: "/foo/baz/", which is what you want, as far as I understand.
I leave it to you to adapt to your specific regex package, which I do not know.
|