Vidéos d'aide de Screencast
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Extracting Text to different variable from a Email body

Created: 04 Fév. 2013 • Updated: 26 Août 2013 | 4 comments
Ce problème a été résolu. Voir la solution.


I am trying to Extract the text from our auto generated email from one of our systems in the given below formats


Employee id 000000



Name                Employeeid                          email

xxx,yyy                 000000                  

Is there a proper way to extract the name email and employee id sothat i can further process it to create a ticket.

Commentaires CommentairesAccéder au dernier commentaire

l'image des reecardo

The Iterate Text File Lines component will do you a lot of good here (when used in conjunction with, and not exclusively using, the Extract Text From Text component)

Your first step is to get the contents of your email into a file data type... you can do this with a Create Text File component.

Next, use the Iterate Text File Lines to navigate through your new file. In the first example above, I'd make my iteration loop check if the line started with Name (can use a Index of Text Within Text comp... if Index is 0, it starts with Name). Then trim off the Name part, and then you're left with the actual name. Rinse and repeat for the Employee ID and Email.

In the second example, again use your Iterate component. If you come to a row that looks exactly like that heading row (Name <spaces> Emp D <spaces> Email), you know your next row is going to contain the data. At that next row, you'll have to do some text handling to isolate the various parts. There are a number of ways to do this: for employee ID, you could try using a Strip Non Number Characters From Text comp on the whole line to try and isolate the employee number. For Email, you could try using an Index of Text Within Text comp to look for an @ symbol, then count a number of characters before and after to get the email (brute force basically)

l'image des etk1131

I used an Extract Text By Pattern component to do this in our environment (7.1 SP1). 

If the format you're using is like the first set of examples, you can use Name as the start of the pattern, and then use Employee ID as the end pattern.  What's left should be the Employee Name.  Same method applies to the other two categories.  For the Email part, you can use your domain name as the end pattern if no other text exists in the email to use.  If you end up using the domain name, you'll have to add it back in using a Text Merge (just take the variable you specified when you extracted the user part of the email address and add to it).

Just note that in order to use the Extract Text By Pattern to work, the email must be in plain text format.  Otherwise it picks up the HTML tags, and I didn't have any luck with trying to extract based on the tags.

Hope this helps.