robertkrimen / otto

A JavaScript interpreter in Go (golang)
http://godoc.org/github.com/robertkrimen/otto
MIT License
8.01k stars 584 forks source link

Regular expression error: Invalid regular expression: re2: Invalid \1 <backreference> (and 1 more errors) #530

Closed tocha688 closed 1 month ago

tocha688 commented 1 month ago

Invalid regular expression: re2: Invalid \1 (and 1 more errors)

var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m;
stevenh commented 1 month ago

This is a known limitation as the current implementation uses re2 syntax. If you're interested in having this work please test out https://github.com/robertkrimen/otto/pull/480 which provides configurable regexp including fully javascript compatibility.