- Joined
- Oct 24, 2012
- Messages
- 6,545
Hello everyone. I have started working with regex and i was wondering if there is a way to simplify this expression. It is currently working. I just think there would be a way to simplify it.
I have been using this site for help on how to make it faster. http://regex101.com/
Here is my regex
Here is the list of test string that should and should not match.
Thanks for anyone that helps.
I have been using this site for help on how to make it faster. http://regex101.com/
Here is my regex
Code:
^(([a-zA-Z]{2,}|[a-zA-Z]{2,}( [a-zA-Z]{2,}| [0-9]{1,})))( \/ [a-zA-Z]{2,}|[a-zA-Z]{2,}( [a-zA-Z]{2,}| [0-9]{1,}))*$
Here is the list of test string that should and should not match.
Code:
Matches:
example
example asd / example
example / example
example / example / example / example
example / example 343345 / example 2 / example
triggered
example 3
example 3 / example 3
example / example 3
Non-matches:
example / example /
example / /
1 / a
a
123
1
Thanks for anyone that helps.