[cl-ppcre-devel] Buffered multi-line question

Sébastien Saint-Sevin seb-cl-mailist at matchix.com
Thu Oct 14 08:46:56 UTC 2004


> > As far as I understand it, (?s:(?=.{n})) will only garantee that at
> > least n chars are remaining from match-start in the consumed
> > string. This is not what I want. I want something that garantee that
> > match-start will be before index n (meaning n'th char in consumed
> > string), wether match-end is before or after this index n.
>
> Well, you could compute n from what you know but that would imply
> creating a new regular expression for each iteration which is probably
> not what you want.

Exactly, in fact I need n to be a parameter of the engine, or a parameter of
the
compiled regex (like prepared SQL statements !).

>
> > Here is what I've got right now (it's ok for my needs actually).
>
> I was actually thinking about a simpler version which was just a
> zero-length thingy that you could insert anywhere in your code and
> which would call a user-defined function. It'd be more efficient and I
> think you could still achieve with it what you want.
>
> I'll try to release something in the next days.
>
> Cheers,
> Edi.
>
>

I'm not sure to fully understand what you mean.
I've coupled filter with registers coz I plan to use it at multiple places
in the regex.

Ex: If I use two dictionaries, I can say (regex string in double quote (no
parse tree here)).

(:sequence
   (:register "\b\w+\b")
   (:filter 1 check-dic1)
   " *[0-9]{5} *"
   (:register "\b\w+\b")
   (:filter 2 check-dic2))

This would match the full string that consists of two words that are in my
dictionaries and that are separated by space(s)-fivedigits-space(s). Plus, I
can extract via registers the two elected values.

Cheers,
Sebastien.





More information about the Cl-ppcre-devel mailing list