paribasu has asked for the wisdom of the Perl Monks concerning the following question:
$line="src/utility/include/abc.pl@@/main/f1/f2/1 /main/f1/f3/f6/f7/3, /mian/1; 123\"\;"; print "TEST : .$line\n"; $line =~ s/\/main\/.*?(,|;|\"|\s)/%I%/g; print "\nReplacing with %I% : $line\n";
Output : Replacing with %I% : /src/utility/include/abc.pl@@%I% %I% %I% 123";
Now I don't want the delimeter to be replaced in the above cases but I have to take delimeter inside my search string for replacement of the /main/.*? portion i.e I want perl to repalce upto the first occurence of any of the delimeters (,|;|\"|\s) whenever my search condition satisfy but not the delimeter itself. Thanks & Regards
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: search and repalce excluding delimeter
by grizzley (Chaplain) on May 09, 2008 at 06:39 UTC | |
by ikegami (Patriarch) on May 09, 2008 at 07:12 UTC | |
by paribasu (Initiate) on May 09, 2008 at 06:42 UTC | |
|
Re: search and repalce excluding delimeter
by Corion (Patriarch) on May 09, 2008 at 06:41 UTC |