Forum Discussion
Here is some documentation on the String replace function (our docs). If you google “Javascript String replace” you’ll get many hits.
The replacer function that we pass to replace() will be passed these parameters:
-
The first parameter will be the matched substring (ex: _matched).
-
The parameters after that will correspond to any parenthesized groupings. We just so happen to define two groupings for each regex, so we know that we’ll be passed two parameters for each of these expressions. We could call these whatever, p1 and p2 for example. We used more meaningful names.
Per the docs, we will also be passed an offset and the original string, if added those parameters. I haven’t tested this. Original string would be quite large. I’m not a JavaScript expert, and continue to be impressed with the power of SnapLogic’s expression language.
Awesome explanation! Thanks very much!