Hi, I need a hand with the a regex. I use a parsing service that parses a document and abstracts dates which are returned as a string. I use the following expression to parse the string: parseDateTime($InputString, 'dd-MM-yyyy') however sometimes a unparsable string is return (e.g. the string "heden" is often returned. Can anybody help me find/construct a regular expression that will allow only stings that can also be parsed with the expression above? thanks a lot hp
Han Pieter Duyverman
Instead of using a regular expression, you could use the parseDateTime variant that returns a default value if parsing fails, like this:
parseDateTime($inputString, 'dd-MM-yyyy', empty)
This will yield a date if parsing the string succeeds, and an empty value otherwise. Afterwards you can check if the value is empty to know whether parsing succeeded.