[Gambas-user] IsDate(string) - how good is it?
Gianluigi
bagonergi at gmail.com
Thu Jan 6 17:06:40 CET 2022
Il giorno gio 6 gen 2022 alle ore 16:53 bb <adamnt42 at gmail.com> ha scritto:
> 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
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
It should be something like this:
If RegExp.Match(value,
"([0-9]{1,2})(/|-|.)([0-9]{1,2})(/|-|.)([0-9]{2,4})") Then...
g
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220106/287d3943/attachment-0001.htm>
More information about the User
mailing list