regex validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 12:53 PM
Hi! I've a question for my regex validation, I need to validate that the // or \\ can be inserted in the rest of the string but not at the first character.
I'm working with this regex but not allowed // or \\ at the rest of sentence.
Can somebody help me with my regex?
This is my expression regex = /^[A-Z0-9./]([A-Z0-9\-.()\s]{1,2}[A-Z0-9\-./()\s]?)*$/;
Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 09:53 PM
Hello @Carina4 ,
Please use this regex pattern
pattern = /^(?!\/\/|\\\\).*/;
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 10:00 PM
try the below regex
^(?!/[/\\])[\w\s.()-]*$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 10:46 PM
Hi @Carina4 ,
Sure, here's a regular expression pattern that satisfies your requirements:
^[^/\\][A-Za-z0-9.\/]*([\\/]{2}[A-Za-z0-9.\/]*)*$
Please mark my solution as helpful if it worked for you.