[Gambas-user] IsDate(string) - how good is it?

bb adamnt42 at gmail.com
Thu Jan 6 16:52:50 CET 2022


On Thu, 2022-01-06 at 16:17 +0100, Gianluigi wrote:
> About RegExp, you could do something like this :
> 
> Private Sub IsAProbableDate(value As String) As Boolean
> 
>   If RegExp.Match(value, "([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})")
> Then
>     Return True
>   Else If RegExp.Match(value,
> "(([0-9]{1,2}))/([a-zA-Z]{3,10})/([0-9]{2,4})") Then
>     Return True
>   Else
>     Return False
>   Endif
> 
> End
> [code]
> 
> Regards
> Gianluigi
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
Yes, I like that one. I think I might need to cope with different
separators  :
If RegExp.Match(value,
 "(([0-9]{1,2}))[/-.]([a-zA-Z]{3,10})[/-.]([0-9]{2,4})") Then
     Return True

Is that right? I am not a regexp expert.

b



More information about the User mailing list