Loading ...
Sorry, an error occurred while loading the content.

regex question

Expand Messages
  • frank visser
    hi all, i am trying to write a regex that catches two types of javascript: aaa and
    Message 1 of 2 , Jun 17, 2005
    • 0 Attachment
      hi all,

      i am trying to write a regex that catches two types of javascript:

      <a href="javascript:void(window.open
      ('https://ssl.intel.com/itn'))">aaa</a>
      and
      <a href="javascript:window('https://ssl.intel.com/itn2'))">bbb</a>

      this regex catches both (as typed in xenu.ini) :

      [Options]
      Javascript=javascript:(void\()?[._a-zA-Z0-9]+\(['"](https?://[^'"]+)
      ['"]

      (I used an online regex tester:
      http://www.regular-expressions.info/javascriptexample.html)

      however, in xenu 1.2g, the first one is not matched, but the second
      one is (contrary to my expectation).

      would anybody know why this happens?

      and how can I rewrite the regex so it matches the first URL, using
      window.open, in Xenu as well?

      thanks for any help!

      evgeny, are you there? ;-)

      frank
    • frank visser
      found the solution myself, added the ( to the character class, everything between javascript and the start single quote of the URL is matched: [Options]
      Message 2 of 2 , Jun 17, 2005
      • 0 Attachment
        found the solution myself, added the "(" to the character class,
        everything between "javascript" and the start single quote of the
        URL is matched:

        [Options]
        Javascript=javascript:[(._a-zA-Z0-9]+\( *['"]((/|ftp://|https?://)
        [^'"]+)['"]

        it now resolved both URLs:

        https://ssl.intel.com/itn
        https://ssl.intel.com/itn2

        frank


        --- In xenu-usergroup@yahoogroups.com, "frank visser"
        <f.visser3@c...> wrote:
        > hi all,
        >
        > i am trying to write a regex that catches two types of javascript:
        >
        > <a href="javascript:void(window.open
        > ('https://ssl.intel.com/itn'))">aaa</a>
        > and
        > <a href="javascript:window('https://ssl.intel.com/itn2'))">bbb</a>
        >
        > this regex catches both (as typed in xenu.ini) :
        >
        > [Options]
        > Javascript=javascript:(void\()?[._a-zA-Z0-9]+\(['"](https?://[^'"]
        +)
        > ['"]
        >
        > (I used an online regex tester:
        > http://www.regular-expressions.info/javascriptexample.html)
        >
        > however, in xenu 1.2g, the first one is not matched, but the
        second
        > one is (contrary to my expectation).
        >
        > would anybody know why this happens?
        >
        > and how can I rewrite the regex so it matches the first URL, using
        > window.open, in Xenu as well?
        >
        > thanks for any help!
        >
        > evgeny, are you there? ;-)
        >
        > frank
      Your message has been successfully submitted and would be delivered to recipients shortly.