- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2022 08:02 AM
Hi guys,
I am trying to utilize regular expression in an Inbound Email Action script.
I am trying to parse an email body (email.body_text) and extract few line between 2 keywords.
Regular Expression Pattern: '/Address:(.*?)Phone Number/s'
The above pattern is valid verified at https://regex101.com/
Syntax in the script is as follows.
var regExp = new RegExp('/Address:(.*?)Phone Number/s');
var body_text = email.body_text.toString();
var extract_address = body_text.match(regExp);
in the log statement "extract_address" is null.
I am not sure why it is happening so.
Any suggestions will be of great help.
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2022 11:39 PM
Hi
sorry my bad. Please use the following modified expression
/Address:([\S\s]+?)Phone Number/g
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022 04:12 AM
Thanks for the response and glad that it is working for you now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2022 07:30 AM
Hi,
Following this thread. I am working on inbound email action to write a regular expression to identify external reference number and if the number matches to the subject line (short description) of the incident, it should update. If the reference number ( "/ref #\[0-9]{20}/" ) does not match it should create an incident. Can you please help me on this. Thanks in advance