Re: [xml] Additional regexp test files
- From: Pete Cordell <petexmldev codalogic com>
- To: xml gnome org
- Subject: Re: [xml] Additional regexp test files
- Date: Tue, 19 Apr 2016 17:24:00 +0100
I've tried to reduce the patterns that I reported earlier to a minimal
form. For the timestamp pattern I've ended up with:
=>ab?c{0,1}
#fails
a
#ok
ab
abc
ac
Interesting the following patterns all pass, even though conceptually
they are the same pattern. So I guess there is a difference between
handling c? and c{0,1}. That might give a clue as to how to fix the
problem.
=>ab?c?
a
ab
abc
ac
=>ab{0,1}c{0,1}
a
ab
abc
ac
=>ab{0,1}c?
a
ab
abc
ac
=>ab?c{1,2}
ac
abc
abcc
acc
For the IP address pattern, the simplest I could get it is to:
=>((2{1,2}|24)\.){2}2
#fails
24.24.2
If it would help to have these in the form of a Git patch or some other
format let me know.
Thanks,
Pete.
--
---------------------------------------------------------------------
Pete Cordell
Codalogic Ltd
Read & write XML in C++: http://www.xml2cpp.com
---------------------------------------------------------------------
On 15/04/2016 17:48, Pete Cordell wrote:
Hi there,
Please can I submit the following regexp test files that should pass,
but when I test them they fail. (I'm afraid I'm not smart enough to
suggest how to fix the code!)
I've attached them and included a git patch so hopefully one of the
formats is convenient for you. If not, let me know what would work
better. I've included them inline below so you can do a quick scan.
test/regexp/fussyipaddress
--------------------------
=>((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])
192.168.254.0
test/regexp/timestamp
---------------------
=>\d{8}T\d{6}\.?\d{0,6}
# This gives incorrect result
20160412T112319
# These give correct result
20160412T112319.
20160412T112319.43
20160412T112319.432312
Thanks,
Pete.
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
https://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]