- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 09:59 AM
I'm trying to use a regex in a field transfor map script to remove HTML markup from a value being imported.
I'm thinking regular expressions aren't supported in this context, but I don't see an error in the logs and I see NO effect on the value when I use a regex.
Has anyone else had this problem?
Here's my script, complete with my trial and errors:
answer = (function transformEntry(source) {
var tagged_text = source.u_sanesystemdescription.toString();
log.info("xform tagged text=" + tagged_text + ", starting");
var textonly = "abc"; // this works
// var textonly = tagged_text.replaceAll("^", "abc"); // broke
// var textonly = tagged_text.replaceAll("^(.)", "abc"); // broke
// var textonly = tagged_text.replaceAll("/<[^>]*>/ig", " "); // broke
// var textonly = tagged_text.repalceAll('<.*?>', " "); // broke
log.info("xform tagged text=" + tagged_text + " complete. New value=" + textonly );
return textonly; // return the value to be put into the target field
})(source);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 10:44 AM
Hi Steve,
Have you tried using replace() instead of replaceAll()? Watch the quote too! If you are using slash notation, you don't need quotes.
var textonly = tagged_text.replace(/<[^>]*>/ig, " ");
Give that a try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 10:44 AM
Hi Steve,
Have you tried using replace() instead of replaceAll()? Watch the quote too! If you are using slash notation, you don't need quotes.
var textonly = tagged_text.replace(/<[^>]*>/ig, " ");
Give that a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 12:32 PM
Ding ding ding ding!
As usual, your advice was spot on Chuck!
In fact, it was better advice than I get on StackOverflow ( which didn't work! )
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 01:17 PM
Thanks. Glad it works. I don't beat StackOverflow too often.