in reply to search and repalce excluding delimeter

Use assertion:
$line =~ s/\/main\/.*?(?=,|;|"|\s)/%I%/g;

Replies are listed 'Best First'.
Re^2: search and repalce excluding delimeter
by ikegami (Patriarch) on May 09, 2008 at 07:12 UTC

    The following is cleaner.

    $line =~ s{/main/[^,;"\s]*}{%I%}g;

    It's a little different, but it'll behave the same if /main/ is always followed by one of the delimiters.

Re^2: search and repalce excluding delimeter
by paribasu (Initiate) on May 09, 2008 at 06:42 UTC
    Thanks grizzley.

    That did the job.