[Gambas-user] Multiline RegExp

Demosthenes Koptsis demosthenesk at ...626...
Wed Jul 27 12:53:47 CEST 2011


Thanks Ian!

It would be more easy the RegExp to return an Array of results like grep
returns all the matches of multiline text.


On Wed, 2011-07-27 at 20:13 +1000, Ian Haywood wrote:
> On Wed, Jul 27, 2011 at 5:34 PM, Demosthenes Koptsis
> <demosthenesk at ...626...> wrote:
> 
> > 2) The Pattern i use is:
> > (?i)\b[a-z0-9._%\-]+@[a-z0-9._%\-]+\.[A-Z]{2,4}\b
> >
> > 3) The result is only one email:
> > dimos at ...146...
> >
> > and not the rest of them.
> as you are only calling regexp once, you will only get one result, you
> need to set up a While..Wend loop
> to go through and find one, then use
> Right$(-(Len(sRegExp.Text)+sRegexp.Offset)) to grab the reminder
> of the string as search that, until the search fails.
> 
> This is inefficient (as a new string is created for each search).
> Benoit, is it possible for Regexp.Exec to have an offset parameter,
> this would allow more
> efficient searching loops.
> It would then be possible to write an iterator to grab all occurances
> of a regexp, and make it 'easy' like in Ruby/Perl.
> 
> Ian
> 
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
Regards,
Demosthenes Koptsis.





More information about the User mailing list