I'm used to using Regex in PHP but haven't really used it much in Javascript; I looked around but couldn't really find an answer other than just a bunch of tutorials on the regex syntax which I don't need.
For example I want to do the below, but with Regex:
if (location != '/group_breaks.php' && location != '/group_breaks' && location != '/group_breaks/') {
}
My regex would be: /^\/group_breaks(\.php|\/)?$/
So I could do this in PHP I could do:
if (!preg_match('/^\/group_breaks(\.php|\/)?$/', $location)) {
}
What is the alternative in Javascript?
/group_breaks?. Edited.