-
All replies
-
Helpful answers
-
-
Sep 6, 2016 7:13 AM in response to WCHawkby VikingOSX,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]);
