[plt-scheme] pregexp-match-positions
On 29/10/2007, Robert Nikander <nikander at nc.rr.com> wrote:
>
> On Oct 29, 2007, at 3:40 PM, Paulo J. Matos wrote:
> > I was expecting for pregexp-match-positions to return a list with all
> > position pairs with a match. It seems, however, that it only returns
> > the first. If this is the case, why not return just a pair instead of
> > returning a list with the pair. Am I missing something?
> >
> > The example:
> >> (pregexp-match-positions "\\[\\s*\\d+\\s+[[:alnum:]]+\\s*\\]" "[1
> >> define] [2 define]")
> > ((0 . 10))
> >
> > On the one hand if it returns all there's a missing pair. It if
> > returns just one, why not return (0 . 10)?
>
>
> If you have groups within your regexp, you get a list with more than
> one pair. Eg:
>
> (pregexp-match-positions "a(a)" "aa") => ((0 . 2) (1 . 2))
>
Oh, ok, got it! :-) Thank you!
> Rob
>
>
>
--
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK