Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8016681

regex capture behaves differently than on V8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • None
    • b100
    • generic
    • generic
    • Verified

      To run marked.js (https://github.com/chjj/marked) on Nashorn, I stripped off the Node related front end and wrote a simple driver: markdown.js.

      There is one regex in marked.js (block.paragraph) whose captures appear to work differently on V8. On V8, both cap[0] and [cap[1] are valid and appear identical, while on Nashorn only cap[0] is defined. The code fails because it expects cap[1].

      To reproduce, execute the attached files:

         jjs markdown.js -- phonegap.md

      Then find the code with a 'batsatt' comment and switch the commented out line for the one above which uses cap[0]. This works.

      I am using Java(TM) SE Runtime Environment (build 1.8.0-ea-b92).

        1. highlight.pack.js
          10 kB
        2. markdown.js
          2 kB
        3. marked.js
          24 kB
        4. phonegap.md
          2 kB

            hannesw Hannes Wallnoefer
            batsatt Bryan Atsatt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: