jow- / ucode

JavaScript-like language with optional templating
ISC License
90 stars 30 forks source link

More regex features #145

Closed ttimasdf closed 1 year ago

ttimasdf commented 1 year ago

Some of the features which seems missing from ucode regex support (not complete, listing some of the features I use):

  1. Negative lookahead (?!)
  2. ranged repetition {1,5}
  3. \w and \d meta escape in [] square bracket expression, like, simple \w+ will work but [\w\d]+ not working.

Sample expressions taken from my script, which are valid expressions for JS:

^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$
https(\+local)?:\/\/([-\w\d@:%._\+~#=]{1,256}\.[\w\d()]{1,6}\b)(?>:(\d+))?([-\w\d()@:%_\+.~#?&\/=]*)
jow- commented 1 year ago

Regexes in ucode are not PCRE but POSIX, there's no plan to change that.