I actually tried comma before but a had another problem that mislead me to think that the comma actually says “this, and this” instead, “this, then this”.
Using the /x|y/ regex pattern is interesting. The only problem I have with this is that it’s single-lined and I prefer something multi lined (this is very short but if it becomes much larger, it’s a problem for me personally).
If you have a complex regular expression and want to split it over multiple lines for readability, you can’t do it directly in JavaScript because regular expressions don’t allow line breaks.
However, you can construct the regular expression from a string and use the RegExp constructor. When you use a string to create the regular expression, line breaks and white spaces are allowed.