The JavaScript regex engine does not support the VERBOSE x modifier, neither built-in nor regular.
See Free Spacing: x (except JavaScript) at rexegg.com:
By default, any space in the regular expression string indicates the character to match. In languages where you can write regular expression strings on multiple lines, line breaks also indicate literals to be matched. Since you cannot insert spaces to separate groups that have different meanings (as you do between phrases and paragraphs when writing in English), a regular expression can become difficult to read ...
Fortunately, many engines support a free space mode that allows you to aerate your regular expression. For example, you can add spaces between tokens.
You can also see that this is called space mode, comment mode, or verbose .
Here's how it might look in Python :
import re regex = r"""(?x) \d+ # Digits \D+ # Non-digits up to... $ # The end of string """ print(re.search(regex, "My value: 56%").group(0))
source share