Topic: How to build java script transformation around regular expression
How to build java script transformation around regular expression
I have a regular expression which I want to use as a java script transformation in Data Cleaner. Is there documentation or an example available on how to do that?
That would be documentation on javascript then, since DataCleaner's javascript transformer simply adheres to the rules of JavaScript.
I like w3schools reference, which also has a pretty good reference on regexes:
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
You define a regex like this:
And you match/test it using either of these functions then:
A simple example could be something like this:
PS: You could also take a look at the Regex Parser extension, maybe it's what you need?
I like w3schools reference, which also has a pretty good reference on regexes:
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
You define a regex like this:
var patt=/hello/g;
And you match/test it using either of these functions then:
var matched = patt.test("hello world");
var matchedPart = patt.exec("hello world");
A simple example could be something like this:
function eval() {
var patt=/hello/g;
return result + ": " + patt.test(values[0]);
}
eval();
PS: You could also take a look at the Regex Parser extension, maybe it's what you need?
Actually the regex parser did the job for now. Next thing is that I will need a filter, so I will use your tips to try and create a JS filter with my regex.
Thanks!
Thanks!
Log in by clicking the login link at the top of the screen
Go back to forum.


