[Gambas-user] pcre component 0.0.3 - working

Rob sourceforge-raindog2 at ...94...
Fri Oct 1 21:53:36 CEST 2004


On Friday 01 October 2004 15:19, Nelson Ferraz wrote:
> 	IF MyStr MATCH "(\w+)" THEN
> 	  PRINT RegExp.SubMatch(0)
> 	END
> I don't know if this is an elegant solution but would be
> handy. :)

It would be more like perl, but I didn't implement the class as 
static and I'm not sure I'd want to.  (I know I've run into 
situations in perl where I clobbered the results of a match with 
a subsequent one, unknowingly.)

> I think it should operate directly on the variable; that's
> what we usually want, isn't it?

No ;)  I always wondered why perl did it the way they did.  Then 
again, in Gambas you can't do an assignment and compare the 
result of the assignment in a single statement as you can in 
perl (or C, etc.) so I can see why one would want to do that in 
Gambas.

> It could return the number of substitutions, so we could
> write:

I'm not aware of any current Gambas methods that change one of 
their arguments, and I think that's contrary to Benoit's design 
intentions.  But he can correct me on that ;)

Have you tried it as it exists now, by the way?  I realized after 
posting it that those who'll want to try it are gonna have to 
manually change a few automake macros (according to the 
instructions for building your own components in the gambas 
wiki) and some people might not realize that.

Rob







More information about the User mailing list