regular expression a or b

regex

Solution

Try:

/^(r|build)\.js$/

'.' should be escaped. If ^ is removed it would match to router.js, if $ is removed it would match r.jsx. So they are needed.

Problem

How do I make regular expression that will match only to r.js or build.js but not to router.js (for example)? I made this: `/^r.js$|^build.js$/` but I feel like there is a way to remove the ^ and the $. If I remove them, router.js get matched.

Original source