[Gambas-user] IsDate(string) - how good is it?
bb
adamnt42 at gmail.com
Thu Jan 6 17:48:42 CET 2022
On Thu, 2022-01-06 at 17:06 +0100, Gianluigi wrote:
> 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
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
Thanks Gianluigi! Finally, after 10 or so years I can now sort gridview
date columns correctly.
b
More information about the User
mailing list