[pcre-dev] [Bug 1414] Add a feature to apply regex in revers…

Página superior
Eliminar este mensaje
Autor: Philip Hazel
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] [Bug 1414] Add a feature to apply regex in reverse order
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1414




--- Comment #1 from Philip Hazel <ph10@???> 2013-11-15 18:53:55 ---
On Fri, 15 Nov 2013, Musician wrote:

> We need the ability to apply a specified REGEX in reverse order i.e.
> beginning from the end of the specified string instead of from the
> beginning of the line.


This idea will, I suspect, sit on the wishlist for a very long time
because it is not something that's straightforward. I write this
assuming you mean something like /^abcd$/ should proceed by first looking
for "d" at the end of the string, then "c", etc.

On the other hand, if you mean "write the regex forwards, but process
the string backwards" (so that /^abcd$/ matches "dcba") it shouldn't be
too expensive to reverse the string before processing, and this is
something you can obviously do yourself.

If all you are trying to do is to look for fixed-length patterns at the
end of a string, note that a regex such as (^.*(?<=abcd)) is an
efficient way to do it.

Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email