- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you help me with my python regex expression?

stewiefre
New Member
11-08-2018
06:53 AM
I'm new in Python, so i have this string:
info1= "Jose Maria Almeida;00351 962341234;1997-12-19"
I'm trying to get the regex expression to that string and i got this:
('[a-zA-Z]+[ ]*([a-zA-Z^;]+);(^00351\s9\d{8}[^;]+$);(\d{4}-\d{2}-\d{2})+')
But when i check if it's valid, it says that it is not.
Could someone help me please?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

bmcaninch_splun

Splunk Employee
11-08-2018
09:45 AM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

stewiefre
New Member
11-08-2018
09:37 AM
Correct answer:
pattern = re.compile(r"^(?P^([A-Za-z]+\s)+[A-Za-z]+);(?P[0-9]+\s[0-9]+);(?P[0-9]{4})-(?P[0-9]{1,2})-(?P[0-9]{1,2}$)")
