JavaScript’s native regular expression engine, the same one used in any browser or Node.js project — patterns should behave the same way here as they would in real code.
What do the different flags do?
g finds every match instead of stopping at the first one, i ignores uppercase/lowercase, m changes how ^ and $ behave across multiple lines, and s lets a dot match line breaks too.
Why does my pattern show an error?
The pattern is not valid regular expression syntax as written — a common cause is an unescaped special character like ( or . that needs a backslash in front of it to be treated literally.