Try a new expression:
^(\p{L}+)(:\p{L}+)?\.(\p{L}+)(-(\p{L}+))*$
But, if you dislike non-Latin letters, you can use [A-Za-z] instead of \p{L}.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I have a string as below in C# :
subject:practitioner.address-state
I have written the regex "^([A-Za-z]+)(:[A-Za-z]+)?.([A-Za-z]+)$" to match the above string but it fails as "address-state" has hyphen (-) in it.
The rest of the part before address-state works fine. Now the last part i.e address-state would have alphabets and/or other characters such as (-,/. etc). It cannot have any numeric value.
I need to modify the above regex to match this.
Regards,
Abdi
Try a new expression:
^(\p{L}+)(:\p{L}+)?\.(\p{L}+)(-(\p{L}+))*$
But, if you dislike non-Latin letters, you can use [A-Za-z] instead of \p{L}.