Help on regex expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 02:54 AM
We have a integation from one servicenow instance orchestration as middle ware, and built an functionality with BR as such when incident is created in INSTANCE1 the description of the incident should be pass over to the incident will be creating in INSTANCE 2
REGEX expression using:
YOur expertize and help will be much appreciated, Thanks in advance !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 04:18 AM
Hi @Chiranjeevi K
What help you really need? You didn't mention why you are using the regex ?
Kindly provde more information.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 04:36 AM
share the API response and what you want from that and want to extract?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 04:46 AM - edited 04-16-2025 04:47 AM
Hello @Chiranjeevi K, Although I'm not sure, I'm assuming that you are trying to replace a sensitive information with a fixed string - 'removed SSN/TAX ID', if so, then this output should be fine .
But, if you'd like to print only that sensitive information and remove other string then you can try to match than replace as below:
var Description, tmp1;
var Description_temp;
var SsnTaxID = /(([^+]\d{2}[-. ]\d{7}(?!\d\d))|(\d{3}[-. ]\d{2}[-. ]\d{4})|(\D\d{9}\D))/g;
var charsAllowed = /[^a-zA-Z0-9.,?\|\^<>:;'!@#$%&*()"\/+=\-_`~{}\[\]\\\n ]/g;
Description_temp = current.description.toString().match(SsnTaxID) || [];
tmp1 = Description_temp.toString().match(charsAllowed) || [];
Description = Description_temp.concat(tmp1).join("");
Regards,
Nishant