Single OR operator in .replace() method

Hello, why do we use single | sign as OR sign in choosing multiple variations in replace() method, not || as we usually do in javascript? Here is the example:

lyrics.replace(/(\r\n|\r|\n)/g, '<br>')

Why we can’t do it like this:

lyrics.replace(/(\r\n||\r||\n)/g, '<br>')

regular expressions have their own syntax, you need to follow it

1 Like