I am writing a regex to satisfy the following conditions
no capital letters,
no spaces, no underscores,
umlauts or special characters and no multiple slashes.
I have implemented this /[^a-z\/{1}\s]/g but still it allows more than one slash. Any idea what I am missing .
if(value.match(/[^a-z\/{1}\s]/g) ){
console.log(invalid)
}
SHOULDNOTMATCH
some_
über
ässs
schleißheim
some?sd
some/7asa+
some one
shouldnotmatche//
dont'allow
/home//some/where/
home
page
thisshouldpass
someothertext
Converting my comment to answer so that solution is easy to find for future visitors.
You may consider this regex for your cases:
/^[a-z]+(?:\/[a-z]*)?$/igm
Which matches 1+ letters at the start i.e. ^[a-z]+ followed by an optional group: (?:\/[a-z]*)? which means match a / followed by 0 or more letters before end position.