Re: [pcre-dev] Remove some restrictions of lookbehind assert…

Góra strony
Delete this message
Autor: Zoltán Herczeg
Data:  
Dla: pcre-dev@exim.org
CC: ND
Temat: Re: [pcre-dev] Remove some restrictions of lookbehind assertions
> > (*SETEND:mark_name)
> >   - This verb changes the end position to the position recorded by the last mark which name is
> mark_name. If the position is smaller than the current string position, it is set to the current string > position.
> By "end position" do you mean "end of subject"? I'm misunderstanding
> something here because won't a MARK name usually be earlier than the
> current position? Or do you envisage using this in some kind of loop? In
> the interpreter, this will be easy to implement only if the MARK is
> earlier on the matching path. Oh, are you thinking of something like
> this?
> (*MARK:A)<stuff>(*MARK:B)<stuff>(*MOVE:A)(SETEND:B)<more stuff>
> That would be straightforward in the interpreter, I think.


Exactly. Usually (*MOVE:A)(SETEND:B) would be in an assertion to check something which should be somewhere before, kind of a generic lookbehind assertion. Maybe we could use capturing blocks for that, which require far less text (and a bit less flexible). Anyway we should not forget about the flags (noteol and friends I think) which controls \z (and friends).

Anyway before we implement anything lets discuss it. I think we can figure out something which is:
- Easy to maintain: I suspect not many people will use this (at least not now), so an easier approach is less likely introduce a lot of new bugs
- Flexible enough in practice: moving string pointers and do a sub-match looks a valid use case. However, since perl does not have have this feature, it is likely that very few practical use cases actually requires it.

Regards,
Zoltan