How to get postal code and email for below regex

Hi

How extract postal code value from regex

Example below is the txt

Postal Code

941332

Customer Service Representative (Optional)

output:
941332

  1. extract email from below test using regex

Email

jac.tiongsothtr@ucgfhng.edumailto:jac.tiongsothtr@ucgfhng.edu

Job Title (Optional)

output:
jac.tiongsothtr@ucgfhng.edu

please provide the solution

Thanks
Likitha

Hi @vinjam_likitha

(?<=Postal Code[\s\S]*)\d+

(?<=mailto:).*

Regards,

Hi @vinjam_likitha

1. Regular Expression to extract Postal Code:
Regex Expression: (?<=Postal Code\s*)\d+
Assign Syntax: System.Text.RegularExpressions.Regex.Match(Input,"(?<=Postal Code\s*)\d+").Value.Trim()


2. Regular Expression to extract Mail ID:
Regex Expression: [a-z.@]+(?=mailto)
Assign Syntax: System.Text.RegularExpressions.Regex.Match(Input,"[a-z.@]+(?=mailto)").Value.Trim()


Regards

Please try this:

postal_code_pattern = r’(?<=Postal Code\s+)(\d+)’

email_pattern = r’(?<=Email\s+)([\w.-]+@[\w.-]+(?:.[a-z]{2,}))’