On 7/17/08, Miles Bader <miles.bader@necel.com> wrote:
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> looking-at does not have a BOUND parameter, but re-search-forward
> have. This makes re-search-forward a bit more flexible.
>
> I am looking at some code where I would have use for that flexibility,
> but I wonder if there is any drawback with replacing looking-at with
> re-search-forward (with an achored pattern).
>
> Is there any? Performance?

If you want to reject matches that extend past some point, just do
something like:

  (and (looking-at REGEXP) (<= (match-end 0) BOUND))
 
Thanks Miles,
 
Yes, that is one possibility. But then perhaps I would assume that re-search-forward better might optimize that search since it can (in theory) cut off the searching at BOUND. In the case I am looking at performance is important.