Regex that does not match any string with any instance of forward or backslash

Viewed 70

I want a regex that will fail to match any string which contains either a forward slash or backslash

I have this regex now

/[^\\|/]/i

in theory, this would not match

aaaa/ooa

age\nange\

but for some reason, this regex seems to match the first character in the string, if the character is a letter, and with the global flag

 /[^\\|/]/ig

it will match any non-forward-slash or non-back-slash

how can I get a regex that will not match any string that contains a forward slash or backslash?

1 Answers
Related