I need to write a regular expression in Perl that will prefix all srcs with [perl]texthere[/perl], like such:
<script src="[perl]texthere[/perl]/text"></script>
Any help? Thanks!
I need to write a regular expression in Perl that will prefix all srcs with [perl]texthere[/perl], like such:
<script src="[perl]texthere[/perl]/text"></script>
Any help? Thanks!
Use the negative lookahead pattern (on the third line below):
This should work:
Test:
Result:
Regards
rbo
I am able to match any src=" except for http via:
^<script src="(?!(https:)).*$
Let me know if there are any issues and I'll fix it.Try using: this website as a regex tutorial and this website to test regex.
Use a proper parser such as HTML::TokeParser::Simple:
Output: