Re: [xml] Regexp Failure
- From: "Pete Cordell" <petexmldev tech-know-ware com>
- To: <xml gnome org>
- Cc: veillard redhat com
- Subject: Re: [xml] Regexp Failure
- Date: Wed, 5 Dec 2007 19:18:36 -0000
Hi,
I think there is a residual problem related to the bug reported below. A
customer of ours is trying to match an IP address using the pattern:
((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])
which should match: 192.168.254.0 but doesn't.
I've tried the version of xmlregexp.c in 2.6.30 and the 2007-11-19 version
included in today's libxml2-cvs-snapshot.tar.gz snapshot.
If I manually expand the effect of the {3} as below, then the pattern
matches OK.
((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.)((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.)((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.)(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])
Also, if I change the pattern to: (i.e. {3} -> {3,4}):
((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.){3,4}(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])
that matches OK as well.
I've tried to reduce the expression to find out where the problem is.
Interesting I've found that flipping the order around of the expressions
makes it work. i.e. when I move the 1?... part to be the last | expression
the pattern matches OK!:
((2[0-4][0-9]|25[0-5]|1?[0-9]{1,2})\.){3}(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])
I hope that gives some insight into the problem.
Thanks,
Pete Cordell
Codalogic
Visit http://www.codalogic.com/lmx/
for XML Schema to C++ data binding
----- Original Message -----
From: "Daniel Veillard" <veillard redhat com>
To: "Ashwin" <ashwins huawei com>
Cc: <xml gnome org>; <ranjit huawei com>
Sent: Wednesday, August 22, 2007 4:43 PM
Subject: Re: [xml] Regexp Failure
On Mon, Aug 20, 2007 at 06:32:43PM +0530, Ashwin wrote:
Hi,
I think the problem occurs when we have the minimum range as 0,
otherwise it works fine. I suppose the problem lies somewhere in the
generation of epsilon states when the minimum range is zero (There is
a separate bit of code for precisely that condition which I am trying
to work out at present:) ) Any pointers....
Thanks!!
Yes this was related to minimum range 0, and also to a problematic
epsilon transition, but the fix required to changes parts of the graph
generation.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]