Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
tpl Perl line to modify URLS
System
tpl code to replace links is not making a global replace even though I am using the /g option.
example line:
<a href="/private/path/file1.html">link to file1</a><a href="/private/path/file2.html>link to file2</a>
Perl statement in TPL to output string with replaced hrefs:
$dcrPara =~ s/href=\"\/private(.*).html\"/href=\"\/injectJSPpath\/private\/injectJSPvirtual$1\.html\"/g;
Result:
<a href="/injectJSPpath/private/path/injectJSPvirtual/file1.html">link to file1</a><a href="/private/path/file2.html>link to file2</a>
The second link is not getting manipulated by the perl statement. If I put a line break in the content between the two links then both links get modified. Can someone see an issue with my perl statement and provide advice?
Find more posts tagged with
Comments
jbonifaci
Well, first of all, get rid of all those escapse you don't need and then make the change in red:
$dcrPara =~ s|href="/private(.*
?
)\.html"|href="/injectJSPpath/private/injectJSPvirtual$1.html"|g;
Let me know if you have any questions.
~Jeff
Migrateduser
This fixed my problem.... THANKS!