I am trying to write a regular expression or regex
for my HTML input field with text type. The user should enter the URI
in the input field. The URI would look something like this: urn:URNNamespace:**:class:ObjClassid
.
Some of the examples of valid URI are as follows: urn:abc:testing:pqrs:1234556.1244 urn:wxyz:testing123:abc:1234556.* urn:global:standard:value:myvalue
I was trying to check only if the initial characters are URN
using the expression ^(urn)://
and check if the string contains the character :
in it.
I just want to make sure that user enters valid URN similar to the one that's provided. Is there any better way I can use and achieve this?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.