Either RegExp is wrong or "matches=" is misunderstood
Posted: 07 Nov 2017 14:49
Hello,
I'm going in circles here trying to figure out why the code below does not work.
Using Regexp Checker the response is TRUE for Date!
There is something I do not understand.
When running under the Regexp tester, 11, 06, and 20 appears with underscore but 17 does not.
I do not know why the 17 (in 2017) is NOT underscored. However the overall return from the tester gives me --> true
group[0]=11/06/2017
group[1]=11
group[2]=06
group[3]=20
NO group for the 17. Why?
When I run the code above in the flow, and use Expression to test the response "resp" is always invalid. Changing MM => 31/06/2017 still (as expected) is invalid).
The Regexp as is, will not detect for example: 31/01/2018. Will work on later.
Thank You
Husky
I'm going in circles here trying to figure out why the code below does not work.
Code: Select all
//Regexp
^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](20|21)\d\d$
SCRIPT:
global_input_value="11/06/2017 12:34:26";
[color=#40FFFF]mmddyyyy[/color]=left(global_input_value, length(global_input_value)- 9); Here is the MM/DD/YYYY
hhmmss=right(global_input_value, length(global_input_value)- 11); Here is the HH:MM:SS
EXPRESSION:
resp=matches([color=#00FFFF]mmddyyyy[/color], "^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](20|21)\d\d$");
There is something I do not understand.
When running under the Regexp tester, 11, 06, and 20 appears with underscore but 17 does not.
I do not know why the 17 (in 2017) is NOT underscored. However the overall return from the tester gives me --> true
group[0]=11/06/2017
group[1]=11
group[2]=06
group[3]=20
NO group for the 17. Why?
When I run the code above in the flow, and use Expression to test the response "resp" is always invalid. Changing MM => 31/06/2017 still (as expected) is invalid).
The Regexp as is, will not detect for example: 31/01/2018. Will work on later.
Thank You
Husky