![]() |
String format checking? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: String format checking? (/thread-16592.html) |
String format checking? - MuntyScruntfundle - Mar-06-2019 What's the most elegant solution for checking a string format where I need to match a single alpha then 3 numerics? examples: p130 is good. 130p is bad. pg130 is bad. p13 is bad. p3p is bad. So in this case I need 1 alpha and 3 numerics. Although a solution that was easily configurable would be good. I could do this with a load of 'if in' checks, but there must be a better answer. Many thanks. RE: String format checking? - buran - Mar-06-2019 re module regex101.com for test purposes and auto generated code |