Login  Register

Re: [ANN] Oniguruma for VisualWorks

Posted by Steven Kelly on May 07, 2012; 8:25am
URL: https://forum.world.st/ANN-Oniguruma-for-VisualWorks-tp4612220p4614277.html

Thanks, that's a great addition! Oniguruma also allows non-greedy matching, which is something else missing from Regex11. Regex11 does however support match groups (see "SUBEXPRESSION MATCHES" in RxParser class>>d:usage:). E.g. for your first example:

"Regex11"
matcher := RxMatcher forString: '^(https?)\://([\w.]+)(/\S+)$'.
urlString := 'http://code.google.com/p/oniguruma-visualworks/'.
(matcher matches: urlString) ifTrue:
    "Ignore 1st subexpression, which is the whole regex's match"
    [(2 to: matcher subexpressionCount) collect: [:ix |
        matcher subexpression: ix]]

#('http' 'code.google.com' '/p/oniguruma-visualworks/')

All the best,
Steve

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Kazuki Minamitani
> Sent: 7. toukokuuta 2012 3:12
> To: [hidden email]
> Cc: [hidden email]
> Subject: Re: [vwnc] [ANN] Oniguruma for VisualWorks
>
> Oniguruma engine takes perl-compatible regular expressions and some
> extensions.
> So you can use 'quantifier' , 'match group' , 'named match group', etc.
>
> --
> "Regex11"
> 'http://code.google.com/p/oniguruma-visualworks/' matchesRegex:
> '^(https?)\://([\w.]+)(/\S+)$'.
>   "==> true"
>
> '2012/05/06' matchesRegex: '(\d+)/(\d+)/(\d+)'.
>   "==> true"
> --
>
> --
> "Oniguruma for VisualWorks"
> "match groups"
> match1 := 'http://code.google.com/p/oniguruma-visualworks/' matchReg:
> '^(https?)://([\w.]+)(/\S+)$'.
> match1 captures "==>  #('http' 'code.google.com' '/p/oniguruma-
> visualworks/')"
>
> "match groups with quantifier"
> match2 := '2012/05/06' matchReg: '(\d{1,4})/(\d{1,2})(\d{1,2})'.
> match2 captures "==> #('2012' '0' '5')"
>
> "named match groups"
> match3 := '2012/05/06' matchReg:
> '(?<year>\d{1,4})/(?<month>\d{1,2})/(?<day>\d{1,2})'.
> match3 captures "==> #('2012' '0' '5')"
> match3 atName: #year. "==> '2012'"
> match3 atName: #month. "==> '05'"
> match3 atName: #day. "==> '06'"
> --
>
>
> I refered ruby1.9 regexp api and testcases.
> I recommend ruby examples and oniguruma ruby-syntax.
> (http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt)
>
>
> Thank you for your interest.
>
>
>
> 2012/5/7  <[hidden email]>:
> > For those of us who are ignorent and naïf about the possible benefits
> of
> > using Oniguruma. Would you be so kind as to explain in a few words
> what we
> > can achieve with it ?
> >
> > Googling and Wikipedia are not really explicit.
> >
> > Thanks in advance.
> >
> >
> >
> > @+Maarten,
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: "Kazuki Minamitani" <[hidden email]>
> > Sent: Sunday, 6 May, 2012 13:17
> > To: [hidden email]
> > Subject: Re: [vwnc] [ANN] Oniguruma for VisualWorks
> >
> > I uploaded just before.
> > Please download from here.
> > http://code.google.com/p/oniguruma-visualworks/downloads/list
> >
> > Regards
> >
> >
> > 2012/5/6 Björn Eiderbäck <[hidden email]>:
> >> I can't find libonigvw.dylib. There is no downloads at the project's
> >> home...
> >>
> >> Best regards
> >> Björn
> >>
> >> On Sun, May 6, 2012 at 3:51 AM, Kazuki Minamitani
> <[hidden email]>
> >> wrote:
> >>>
> >>> Hi all,
> >>>
> >>> I have published 'Oniguruma-Regexp' to the Public Store Repository.
> >>> It is a wrapper library of Oniguruma.
> >>> Oniguruma is a regular expression library which is standard with
> Ruby
> >>> 1.9.
> >>>
> >>> This library needs DLL/CC.
> >>> Dynamic link libraries are here:
> >>> http://code.google.com/p/oniguruma-visualworks/
> >>>
> >>>
> >>> Thanks
> >>>
> >>> --
> >>> Kazuki Minamitani
> >>> [hidden email]
> >>> _______________________________________________
> >>> vwnc mailing list
> >>> [hidden email]
> >>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >>
> >>
> >
> >
> >
> > --
> > Kazuki Minamitani
> > [hidden email]
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
> --
> Kazuki Minamitani
> [hidden email]
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc