简体   繁体   中英

Regex for 00408C followed by 6 unique characters in C#

I would like to create regex for macaddress which start with 00408C followed by 6 unique characters(small letters, big letters, digits).

For example: 00408c1a2b3 or 00408C1A2B3.

How the regex for that would look like in C#?

I think something like that but I do not know how the alphanumeric character is defined in c#. "00408[alphanumeric character]{6}"

那里是:

00408[Cc][a-zA-Z0-9]{6}

If by "unique characters" you mean a character cannot be repeated, you should use this regex:

00408[Cc]([a-zA-Z0-9])((?!\1)[a-zA-Z0-9])((?!\1)(?!\2)[a-zA-Z0-9])((?!\1)(?!\2)(?!\3)[a-zA-Z0-9])((?!\1)(?!\2)(?!\3)(?!\4)[a-zA-Z0-9])((?!\1)(?!\2)(?!\3)(?!\4)(?!\5)[a-zA-Z0-9])

You can find an explanation and demonstration here: http://regex101.com/r/mV6oY7 .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM