I am looking to setup a preg_match for a string that follows the following structure:
- must start and end with alphanumeric characters (can repeat - ex. aaabbb)
- can contain alphanumeric (can repeat - ex. bbb666)
- can contain a period, space, apostrophe or hyphen (non repeating but can have one of each)
‘one–tw’'o- is invalid
o’ne-two three. - is valid
My last try:
^[a-z0-9]+(?:[ '.-][a-z0-9]+)*$/i - only alpha numeric is valid
Thanks