From: Le Chaud Lapin on
Hi All,

Should...

regex_match("12345 ", "(.*|\s)*A.B.C.")

....yield true or false (or throw an exception)?

It is returning true for me.

-Le Chaud Lapin-

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Martin T. on
Le Chaud Lapin wrote:
> Hi All,
>
> Should...
>
> regex_match("12345 ", "(.*|\s)*A.B.C.")
>

Shouldn't that be "(.*|\\s)*A.B.C." ??

> ...yield true or false (or throw an exception)?
>
> It is returning true for me.
>

I don't see how that can match. Testing it with non-C++ is returning
false for me.

br,
Martin

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Le Chaud Lapin on
On Oct 6, 5:38 am, "Martin T." <0xCDCDC...(a)gmx.at> wrote:
> Le Chaud Lapin wrote:
> > Hi All,
>
> > Should...
>
> > regex_match("12345 ", "(.*|\s)*A.B.C.")7
>
> Shouldn't that be "(.*|\\s)*A.B.C." ??

Yes...I copied the text above directly from the Visual Studio 2008
debugger window, hence absence of requisite escaping blackslash.

> > ...yield true or false (or throw an exception)?
>
> > It is returning true for me.
>
> I don't see how that can match. Testing it with non-C++ is returning
> false for me.

Yes, it should return false, or throw an exception, IIUC, but it is
returning true.

My compiler is Visual Studio 2008 with al TR1 updates. Here is a small
sample program to test:

#include <regex>
#include <iostream>

int main ()
{
using namespace std;
using namespace tr1;
char *pattern = "(.*|\\s)*A.B.C.";
basic_string<char> text("12345 ");
basic_regex<char> rx(pattern, regex_constants::ECMAScript |
regex_constants::icase);
if (regex_match (text.c_str(), rx))
cout << pattern << " matches " << text << endl;
else
cout << pattern << " does not match " << text.c_str() << endl;
return 0;
}

Please note that I know that the "(.*|\\s)*A.B.C." is somewhat bogus.
While attempting to employ RE's to a project, I accidentally typed
this in, and it returned true.

I am now trying to determine if there is an error in my perception or
a bug in TR1's regex framework. If it's the former, I would like to
understand what it is I do not understand. If it is the latter, I have
to determine if the framework is reliable enough to process about
55.6GB of data with RE's that are dynamically-generated from the data
itself.

-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Le Chaud Lapin on
On Oct 7, 12:07 am, Le Chaud Lapin <jaibudu...(a)gmail.com> wrote:
[snip]
> I am now trying to determine if there is an error in my perception or
> a bug in TR1's regex framework. If it's the former, I would like to
> understand what it is I do not understand. If it is the latter, I have
> to determine if the framework is reliable enough to process about
> 55.6GB of data with RE's that are dynamically-generated from the data
> itself.

After further investigation, I (we) have determined that the TR1
<regex> framework supplied by Microsoft with Visual Studio 2008 [and
some very early versions of Visual Studio 2010] is buggy, which makes
me wonder why the other regex's supplied by Dinkumware are not buggy.
Or are they?

Q: Are there any regex frameworks out there where the author is
confident that the implementation is correct and bug free?

I simply cannot use a regex framework that "works most of the time"
because in my case, the expressions themselves derive from the data
being analyized. In such situations, DFA's are bit like strlen(): they
are not allowed to be buggy.

-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

 | 
Pages: 1
Prev: Recursive friendship
Next: Shallow\Deep copy