Hello Friends!
So i need a RegEx Pattern for following Problem:
I have a Variable Amount of Documents with the Same Structure
But in the Documents are Informations like First and Lastnames, Emails, Phone Numbers etc.
So now i need a Regex Pattern for this:
First Name: (Comment: Name could be like:) Eric but also like (Paul Ericsen) so ne Real Structure looks like this:
First Name: Eric Paul
Last Name: Paulsen Stevesen
Email: eric.paulsen@Paulsen.com Paul.Steve018@Gmail.com
Phone Number: +31 (0) 123 4567895 0123 45678954
Each Site is (Left Eric, Right Paul) Stays for a Own Person
i Need a Pattern for each Dynamic way. So that the Pattern would Match: Eric, but also a Name Like Ann Katrin
Anil_G
(Anil Gorthi)
2
@Beere_Plays
You can try with this expression (?<=First Name:).*
System.Text.RegularExpressions.Regex.Match(input,"(?<=First Name:).*").Value
Replace first name with other values to get each of it
And fot email as it can be in multiple line try like this (?<=Email:)(.|\n)*(?=Phone Number)
System.Text.RegularExpressions.Regex.Match(input,"(? <=Email:)(.|\n)*(?=Phone Number)",RegexOptions.Multiline).Value
Hope this helps
Cheers
Cheers
Hey Thank you for your Fast Response, but the Blog Post deleted my formation of the Text
It should had look like this:
First Name: Eric | Paul
Last Name: Paulsen | Stevesen
Email: Eric.paulsen@paulsen.com | Paul.Steve017@gmail.com
Phone Number: +31(0) 123 4567895 | 0123 123456789
But in the Real Document there are no |
But for your Understanding, the | seperates Two individually Person and so Individually Outputs
Anil_G
(Anil Gorthi)
4
@Beere_Plays
After extracting you can split on space str.Split(" "c)
then you can get each value separately…
For phone number are there any specific number of number? Like a specific count?
Cheers