Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Regex to allow only a single slash but not multiple slashes

enter image description hereI 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)
 }
  1. these values should fail to pass a test

  SHOULDNOTMATCH
  some_
  über
  ässs
  schleißheim
  some?sd
  some/7asa+
  some one
  shouldnotmatche//
  dont'allow
  /home//some/where/
  1. These values should pass a test

   home
   page
   thisshouldpass
   someothertext
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

RegEx Demo

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!