Regex doesn't match in Perl, does on Sublime Text 3 -


i have regular expression trying match on strings containing:

<script type="text/javascript">    var debug = new debugger(); </script> 

i have determined suffices use word "debug" match on.

if execute command:

find . -name 'test.html' -exec perl -ne '/<script type="text\/javascript">[\s\s]*?(debug)[\s\s]*?<\/script>/ && print' '{}' \; 

i expect regex match, regex string

 <script type="text\/javascript">[\s\s]*?(debug)[\s\s]*?<\/script> 

matches on sublime text.

i have had trouble using [\s\s] perl. there missing here?

thanks

you want use perl's paragraph mode (-0) when calling it. using this, regex work:

find . -name 'test.html' -exec perl -n0e '/<script type="text\/javascript">[\s\s]*?(debug)[\s\s]*?<\/script>/ && print' '{}' \; 

(not?) surprisingly @sputnick gets gold medal answer here ;)


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -