简体   繁体   中英

Checking the pattern containing numeric values, comma, space and colon in Regex

I have a string in c#, say str. Using regex, how can I check if it matches the format 'n, To: n'. Here n is a numeric value between 0 and 4999.

If the numbers need not be same:

([0-4]?\d{1,3}) To:([0-4]?\d{1,3})

If the numbers need to be the same; your pattern will be:

([0-4]?\d{1,3}) To:\1

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