Skip to main content

My most used function in ServiceNow? Text comparison!
My most used function in ServiceNow? Text comparison!

·1 min read
Share

In the world of data transformation/migration is the most common thing (in my case) is data verification and text comparison. Usually, there is source and target value and some logic in the background.

Mostly used string operations by me:

  1. remove spacesremove all spacesremove special characterscase insensitive

The function:

function removeSpecialChars(str) { return str.replace(/(?!\w|\s)./g, '') .replace(/\s+/g, ' ') .replace(/^(\s*)([\W\w]*)(\b\s*$)/g, '$2') .replace(/ /g,'') .toLowerCase(); } 

Do you need help with data migration/integration/transformation? Let us know.

L

Lubos Strejcek

Content Writer at STREYDA