Menu

Javascript RegExp problem

Help
AdamWu
2008-01-15
2013-04-10
  • AdamWu

    AdamWu - 2008-01-15

    Hi, I found the regular expression used to match javascript:
    '(?:<script.*?>)((\n|.)*?)(?:<\/script>)'
    does not work as expected in Firefox.
    I couldn't tell what went wrong, but it just does not match any of my scripts at all.... but on IE it worked fine.

    After playing with it for a while, I found a version that works for both browsers:
    '(?:<script.*?>)([\\s\\S]*?)(?:<\/script>)'

    '[\\s\\S]' is said to really match anything including \n \r and something else that '.' does not match.
    Maybe I has some weird characters in my script file, who knows...

     
    • Virtimus

      Virtimus - 2008-01-19

      Thans for the fix - I'll check it and include in next release.

       

Log in to post a comment.