CommunityCommons RegexTest

1
In the Community Commons module there is the java action RegexTest. I thought this was the only way to test a regex in a microflow untill Samet Kaya pointed me to the isMatch function (thanks Samet). I have something strange with the following regex: '^(20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])\d\d\d\d.pdf' When I test this regex with RegexTest it gives me false with this filename 2012-02-080267.pdf (which is wrong). When I test it with isMatch it gives me true (which is right). Anybody an idea why they differ? Bug? And why is this java action in the community commons module when this can be done with isMatch?
asked
2 answers
1

You pass it the name of the regular expression to the function? The function doesn't work that way, you can only directly pass it regular expressions. Now it will to match everything against the name of your regular expression :).

The function is there because it existed before isMatch, and in that respect it is obsolete now.

Note that the regex replace function of the module and runtime do defer with respect to their replacement value handling.

answered
0

With the help of a regex tester: in java you need to escape back slashes to get a backslash in a string:

^(20)\\d\\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])\\d\\d\\d\\d.pdf
answered