• cgtjsiwy@programming.dev
    ·
    1 year ago

    Regular expressions are great and can always be matched in linear time with respect to the input string length.

    The problem is that JS standard library RegExps aren't actually regular expressions, but rather a much broader language, which is impossible to implement efficiently. If RegExp switched to proper regular expressions, they would match much faster but supporting backreferences like /(.*)x\1/ would be impossible.