[Gambas-user] Multiline RegExp

Demosthenes Koptsis demosthenesk at ...626...
Wed Jul 27 09:34:04 CEST 2011


i used also Multiline
http://gambasdoc.org/help/comp/gb.pcre/regexp/multiline?v3

and DotAll
http://gambasdoc.org/help/comp/gb.pcre/regexp/dotall?v3

with this code

-------------------------
' Gambas class file

Private sRegExp As Regexp

Public Sub Form_Open()

  Me.Center

End

Public Sub btnMatch_Click()

  txtResults.Clear
  
  If IsNull(txtPattern.Text) Or IsNull(txtSubject.Text) Then Return
  
  sRegExp = New Regexp(txtSubject.Text, txtPattern.Text, 4)
  
  If sRegExp.Offset = -1 Then Return
  
  txtResults.Text = sRegExp.Text

End
-------------------------

1) The Subject of RegExp is:

Here is an email dimos at ...146... and text continues
Here is an email kostas at ...146... and text continues
Here is an email petros at ...146... and text continues
Here is an email paul at ...146... and text continues

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.

4) if i convert this pattern to grep syntax in terminal, grep gives all
4 emails. i want to implement a grep like funtcion with Gambas3

Thanks!




On Wed, 2011-07-27 at 12:45 +1000, Ian Haywood wrote:
> On Wed, Jul 27, 2011 at 8:34 AM, Bruce Bruen <bbruen at ...2308...> wrote:
> > regexp only (ever) works on a line by line basis
> by default yes, but:
> http://gambasdoc.org/help/comp/gb.pcre/regexp/dotall
> 
> this makes the . cover newlines, so a regexp can span multiple lines
> in the string.
> 
> 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