The format of a regular expression can be rather complicated. To make sure you didn't miss some slash of quotation mark, place the caret somewhere in the expression you want to check, and press &shortcut:ShowIntentionActions;.

In the pop-up frame type a string that you think should match your regular expression. If the background turns green, you are lucky. If it turns red, then you have to look for a mistake.