Regex in python to catch a string like MMS-2839 -


how can catch string these regex in python?

m1sxs-2839 mcs-28s9213 

both first , second part (divided -) can contains letters , numbers (case insensitive).

you may try below re.match function.

re.match(r"(?i)[a-z0-9]+-[a-z0-9]+$", st) 

(?i) helps case-insensitive match. since re.match scans input start, don't need add start of line anchor ^ explicitly.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -