myString = myString.replace(/\D/g,'');
reference here
Hope this helps!
Tudor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:32 AM
Hi
I have requirement to remove special characters from Phone number . I have attached link below .
Link - https://carear.app/#/s/dl.htm?serviceNow=true&id=WO0010026&name=Virendra%20Dwivedi&table_name=wm_order&table_sys_id=671e9e3c4792c110665a4e42846d436a&contact_mobile=(989)%20898-9898&contact_email=abel.jackson@mail.com&fqdn=ven04940.service-now.com&origin=https://ven04940.service-now.com/now/workspace/agent/record/wm_order/671e9e3c4792c110665a4e42846d436a&file_name=true
If you see the phone number part has brackets , % and hyphen . Is there a way to remove these special characters .
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:38 AM
Hey,
Why don't you try a simple function:
mystring='123 test 456 String 789 cleaning';
onlyNumeric=GlideStringUtil.getNumeric(mystring);
gs.info(onlyNumeric);
Output: 123456789
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:38 AM
Hey,
Why don't you try a simple function:
mystring='123 test 456 String 789 cleaning';
onlyNumeric=GlideStringUtil.getNumeric(mystring);
gs.info(onlyNumeric);
Output: 123456789
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:38 AM
Hi Virendra,
When parsing the URL you can use the following :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:59 AM
Hi,
what's your business requirement here?
where is this link present?
basically those special characters indicate something
%20 - means space
It helps in URL encoding and is required
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader