Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am a novice to perl and am facing problem in acheiving replacement in the middle of a string. I am posting this request to you as this task must be acheived in aquick time.
Here is the String $str ="//111.11.112.12/abc/main/myfolder/docs";
i need to find the pisotion of the "main" and replace all the text occuring upto the "/" preceding the "abc".
Iattempted with search and replace but the problem is, ineed to search for the "/main" and replace anything before it till the previous "/" (the slash before the "abc" in this case).
I shall be greatly obliged.
with regards
A
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex for replacement
by davido (Cardinal) on Jul 08, 2004 at 06:28 UTC | |
|
Re: Regex for replacement
by davidj (Priest) on Jul 08, 2004 at 06:33 UTC | |
|
Re: Regex for replacement
by ercparker (Hermit) on Jul 08, 2004 at 06:46 UTC | |
|
Re: Regex for replacement
by murugu (Curate) on Jul 08, 2004 at 06:49 UTC | |
by davido (Cardinal) on Jul 08, 2004 at 07:02 UTC |