[Gambas-user] how to do a regex in gambas?

Rob sourceforge-raindog2 at ...94...
Fri Apr 11 19:51:15 CEST 2008


On Friday 11 April 2008 11:49, M0E Lnx wrote:
> I've been wondering for a while how to do a regex in gambas...
> For instance, I'm trying to say something like this
> IF Exist("/path/to/some/dir/*.tar") THEN
> blah blah blah
> How can I accomplish that in gambas2?

Well, you're not really looking for a regular expression (if you were, 
I'd suggest gb.pcre).  You should be able to get by with just a 
wildcard.  Try something like this pseudo-code:

Dir("/path/to/some/dir/", "*.tar") to tmparray
if tmparray.count > 0 then 
	' blah blah blah
end if

You can actually use some regular expressions in Dir() as well.  
Check the documentation.

Rob




More information about the User mailing list