I am looking for a regex to create a string of characters with the following criteria:
- Can be variable length (max 30 characters)
- Can have only alphanumeric (a-z,A-Z) and Numeric characters(0-9)
- Can have only these special characters “-“,”.” anywhere in the string
- Must start with only alphanumeric or numeric, not special characters
- Must be at least 5 characters
The “badge” string will need to be used in the url of the site, any advice on whether this string would be alright would be appreciated.
Thank you
RegExp’s do not create strings they are used to validate or match them. Is that what you mean?
A RegExp to validate a string against your constraints would be
Explanation :