Date Validation using Expression Library
Hi,
I’m developing a pipeline that uses date input parameters. I was looking to use an expression library to validate the date format by matching a regex pattern.
For example, /^([1-9]|0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19\d\d|20\d\d)$/.test(“05/09/2018”) should return ‘true’
Below are the pipeline properties where I am importing the expression library:
Here are the contents of the .expr file:
{
sd_valid: x => (/^([1-9]|0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19\d\d|20\d\d)$/.test(x))
}
Here is the mapper I am trying to you to call the validation:
I am receiving the following error when trying to validate the pipeline in this case:
“Failure: RegExp type does not have a method named: test. Perhaps you meant: No Regex Methods, Reason: ‘test’ was not found while evaluating the sub-expression ‘/^([1-9]|0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])\/(19\d\d|20\d\d)$/.test(x)’, Resolution: You can check for the existence of a field with the ‘in’ operator (e.g. ‘abc’ in $obj)”
Has anyone else seen this problem and found a solution? Or know a better way to accomplish what I’m trying to do here?
Thank you in advance
Dan