[pcre-dev] [Bug 1600] Issue with Regex

Page principale
Supprimer ce message
Auteur: Philip Hazel
Date:  
À: pcre-dev
Sujet: [pcre-dev] [Bug 1600] Issue with Regex
------- You are receiving this mail because: -------
You are on the CC list for the bug.

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




--- Comment #8 from Philip Hazel <ph10@???> 2015-03-20 11:48:06 ---
On Fri, 20 Mar 2015, Prashant Joshi wrote:

> In our application we used APIs of theses libs.
> I tried to search PCRE version on the older version but do not get.
> In older version we have very few files "pcre.c", "pgrep.c" & "study.c".
> We used function "pcre_complie" & "pcre_exec".


Looks like that is some very, very early version of PCRE, over 15 years
old. It was split into separate files pcre_compile.c, pcre_exec.c, and
so on a long time ago.

> In newer version we have a lot files and we used similar functions in our
> application.


Are you using a PCRE library that is installed in your operating system,
or are you compiling your own library?

> Applications are same for both versions of PCRE.
> No manipulations we have done in regex we directly called these functions.


In that case, the string you pass to pcre_compile() should NOT contain
delimiters. But you have provided contradictory information.

You said:

> > When I changed this regex to below regex it worked with 8.34:
> > Regex 2:
> > /Letzter Messwert[\s]+<\/th><td
> > class="ActualDataTableBody".*>[-+]?([0-9]*\.[0-9]+|[0-9]+)<\/td><td
> > class="ActualDataTableBody".*>[-+]?([0-9]*\.[0-9]+|[0-9]+)<\/td><td
> > class="ActualDataTableBody".*>[-+]?([0-9]*\.[0-9]+|[0-9]+)<\/td><\/tr><tr><th
> > scope="row" class="ActualDataTableRowLabel">Mittelwert/


That regex has delimiters / .... / and you have also escaped the
delimiters within by using \/ where they occur.

The pcre_compile() function does NOT recognize delimiters, so if you
pass that string to it, and then call pcre_exec(), you will be searching
for data that starts

/Letzter Messwert

*including* the leading / character. That is, a call such as

pcre_compile("/Letzer Messwert.....", ....

will match data like this:

...anything anything /Letzer Messwert......

I don't think your problem is a bug in PCRE. Please read carefully the
documentation that comes with the latest release (which is actually
8.36).

Philip


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