Lightning component regex doesn't work
The reason for this seems to be that the framework replaces the first line's asterisk character with the \u002A
Unicode escape sequence before serving the files to the browser.
I'd report a bug if it was possible. Hopefully someone here can raise the issue!
Ye, as you mentioned it is framework's doing. For some reason it converts asterisk in case it is immediately followed by a slash:
new RegExp(/.*/)
would result as
new RegExp(/.\u002A/)
And the parenthesis removes the "immediately followed" situation.