In JavaScript, are regular expressions evaluated in compiled code?

javascript, regex

Solution

That would be up to implementation, but every implementation I know (such as Gecko, Trident), does so in compiled code.

Problem

When a regular expression is run JavaScript, is the regex engine that evaluates the expression compiled code? or the engine itself is written in javascript? While doing some basic string matches tests, I found that a single regex is considerably faster than my JavaScript function that does the same thing, so I wondered why the regular expression was faster. P.S: I'm totally new to regex.

Original source