Tolgar
asked on
How to make a string substitution in a very long string in Perl?
Hi,
I have a very long string and in that string I have the following pattern in most places.
I'd like to convert this types of patterns to the following form:
How can I do it?
I tried the following but it did not work:
The directory names (dir1, dir2, dir3) may change so the rule should be something like this?
Replace between href="file:///// and 20YYMMDD_HHMM with ***
Thanks,
I have a very long string and in that string I have the following pattern in most places.
href="file://///dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/dir11/REPORT_Unix/20YYMMDD_HHMM_ReportDetails.html#/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/dir11/@dir12/@13/file1.cpp
I'd like to convert this types of patterns to the following form:
href="file://///***/20YYMMDD_HHMM_ReportDetails.html#/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/dir11/@dir12/@13/file1.cpp
How can I do it?
I tried the following but it did not work:
$fileLine =~ s{ href=\w+_20 }{\ /20};
The directory names (dir1, dir2, dir3) may change so the rule should be something like this?
Replace between href="file:///// and 20YYMMDD_HHMM with ***
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Any ideas???
ASKER
I tried it both on unix and windows.
What exactly did you try, and how did you try it?
ASKER
I apologize. It works. I made a mistake in overwriting to the file.
ASKER