caoccao / Javet

Javet is Java + V8 (JAVa + V + EighT). It is an awesome way of embedding Node.js and V8 in Java.
https://www.caoccao.com/Javet/
Apache License 2.0
695 stars 66 forks source link

Invalid regular expression, working normally on Node #396

Closed rongrong1000 closed 1 hour ago

rongrong1000 commented 2 hours ago
public static void main(String[] args) throws JavetException {
        try (V8Runtime v8Runtime = V8Host.getNodeInstance().createV8Runtime()) {
            v8Runtime.getExecutor("""
                var a = /\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu
                console.log(a)
                """).execute();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

This expression is part of the underlying 'puppeteer'

caoccao commented 2 hours ago

Please check #222 and #277 out.

rongrong1000 commented 2 hours ago

puppeteer

It seems like this problem is quite tricky

This bug causes the 'puppeteer' module to not work (without modifying the source code)

I'll try to consider other alternative options