The body of the email can vary in text volume. But one consistency is this block of information:
Incident Reported : 04/19/2018 11:30AM
Operating Company : Company Name
Location : 9999
Address : 12345 Anywhere Rd.
City, State, Zip : Arlington, VA 22206
Associate Name : JOHN DOE
Telephone Number : 512-123-4567
Description : DESCRIPTION OF THE INCIDENT BEING REPORTED. CAN BE ANY LENGTH OF CHARACTERS.
Notified Vendor: N
First Vendor Contacted: None
Brand Name: A NAME
We’d like to be able to extract and isolate the above block to its own text field, then manipulate it from there.
Any help is appreciated.Stephanie
There is also any amount of data after the desired block. Our objective for now is to isolate that needed block of information into its own field, and then from there we will be able to use the Part() function to pull it apart even more.
Any help is appreciated.
You used the word "consistency" in describing the information you want to parse out of the text field. More than likely your data is a lot less consistent than you assume as information could appear out of order, could be missing, or contain unexpected characters. One example of the data is insufficient to derive its actual format and structure. Because of this variability is probably best to initially manually supervise the parsing of the data rather than completely automate the process.
Here is a quick demo - Click the Parse button to parse the fields and click the Reset button to reset the fields:
Regexp Capturing Groups
(1) To simplify the maintenance of the demo I have made the [Text] field readonly on the HTML form and provided a Reset button to clear the parsed fields.
(2) For the City, State and Zip information I have parsed the string into individual fields.
(3) This is just a simple demo of parsing data out of a field using script and regular expressions. In fact I wrote the script to allow a user unfamiliar with regular expressions to modify the script without having to understand every detail. However, regular expressions are so powerful that it could easily be adopted for much more complex parsing requirements.
If you need further assistance with implementing this solution feel free to contact me off-world using the information in my profile: