In JavaScript, regular expressions are evaluated in compiled code?

When JavaScript regular expression is executed, is there an expression mechanism that evaluates expressed compiled code? or is the engine written in javascript?

When I performed some basic string match tests, I found that one regex was much faster than my JavaScript function, which does the same, so I wondered why the regex was faster.

PS: I am completely unfamiliar with regex.

+3
source share
2 answers

This will be related to the implementation, but each implemented implementation (for example, Gecko, Trident) does this in compiled code.

+6

, , js.

javascript-, , .

regex javascript, /myregexhere/, . RegEx Javascript, .

+3

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


All Articles