Does Safari support JavaScript RegExp?
In a cross-browser test of RegExp, Safari seemed to not support it.
MacBook Pro, OS X Mavericks (10.9.1)
In a cross-browser test of RegExp, Safari seemed to not support it.
MacBook Pro, OS X Mavericks (10.9.1)
No.
The answer is yes, Safari has supported JavaScript RegExp for years. It is straight forward when used in HTML. If you use RegExp in a Do JavaScript within AppleScript, it invokes an Apple Event, and Safari 9.1.3 will block you with the following dialog:
One then enables Allow JavaScript from Apple Events from the Safari Develop menu, at the cost of a user password prompt when the AppleScript is run.
Look at the Regular Expressions example for JavaScript at Rosetta Code. Add that to a <script> section in an HTML document, and add the following line before your closing </script> tag, before you open the HTML in Safari 9.1.3.
alert(isMatch + " " + matches[1]);
Does Safari support JavaScript RegExp?