Hi I would like to limit spaces in the following examples:
Text_1 = 'Your email: Peter @gmail.com Please enter your spouse's email: Mandy@gmail.com'
Extracted_1 = 'Peter @gmail.com'
Target_1 = 'Peter @gmail.com' (correct)
regex_pattern = r'Your email: [\s]?(.+@[\w.,-]+)'
Text_2 = 'Your email: Please enter your spouse's email: Mandy@gmail.com'
Extracted_2 = 'Please enter your spouse's email: Mandy@gmail.com'
Target_2 = '' (Empty)
With my current pattern, it will end up extracting everything up till the 2nd email. Is there a way where I can limit number of spaces?
Eg. limit 2 spaces so the 2nd example will return empty
Thanks!