Compile a regex rule in Node.js?

Is it possible to compile regex rules in Node.js for faster use?

+4
source share
2 answers
+6
source

Node.js is just JavaScript running on V8, so you really only have what V8 offers, namely:

var r = new RegExp("abc", 'i'); 

V8 will do its own optimization, perhaps even in built-in regular expressions.

+3
source

Source: https://habr.com/ru/post/1414512/


All Articles