I am trying to extract the phone number and full name from a data string, but I can’t figure out a regex pattern needed for extracting the said data, can anyone help me with it
This is the data string:
FYI, I found a regex pattern to extract email and it worked.
btw The tool I use to extract this data only supports positive lookahead regex patterns
Got a sample?
In the meantime try this pattern for the Name.
And this for the phone.
Hi @Fahad_Sheji ,
Instead of regex, I would have split the entire dataset on the newline character. This would present a String array with all the characters of a line in each array items.
I would then parse through each of the array items, and try to split the items with ‘|’, since I don’t see the | being used anywere else. Once split I would check to see if my split actually worked and whether the resulting array has 3 items - i.e. Name, Email and Number.
Once this is done, I would get the 0th position as the Name and the 2nd position element as the number.
This would work depending on the size of your dataset, and whether the | symbol is present anywhere else
But for regex, I think this should suffice -
Let me know if this works for you
Hey, I am quite new to this so not sure how to split the data in the integration tool I use.
Anyways I tried the regex pattern you gave me and it brought in the name of the firm instead of the data we needed.
I’ll add the whole data string for better reference, The highlighted one is what the regex brought in.
Anyways I know it’s hard to locate it without a header, so I looked into the HTML version of the email and it had proper headers before the data such as first name, last name, phone, etc but had the HTML code between, can we easily extract from that? this is the photo
How about the expression?
To get Phone Number
To Get the Name
Hello @Fahad_Sheji , Kind;y try this Regex pattern