www.digitalmars.com         C & C++   DMDScript  

c++.rtl - The regular expression language used is the same as that commonly used

reply Nicholas Jordan <Nicholas_member pathlink.com> writes:
Trying to get going on regular expressions.

The owl book gives:

echo =XX========================================= | egrep 'X(.+)+X'

as a test to determine whether one's regex uses an NFA or DFA engine.

To gain fluency & efficiency, I tried something like:

RegExp re;

char pattern[] = {"X(.+)+X"};
char string[]   = {"=XX========================================="};
if(re.compile(pattern,"i",0x0001))
{
::printf("pattern compiled");
if(re.test(string))
{
::printf("string searched"); 
}
}

This run did not get to the second printf()

To say that: The regular expression language used is the same as that commonly
used .... may be an innovative use of K.I.S.S, one that I have not thought of.

Also, noticed that the i option failed to compile if I uses single quotes - only
worked if I used double quotes.  Reading the compiler .hlp files samples
indicates this should not happen.

Which regular expression language is the one commonly used ?


There are several.

Nick


http://www.docdubya.com/belvedere/statement/index.html
May 07 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Nicholas Jordan wrote:
 Which regular expression language is the one commonly used ?

It's the same r.e. language defined by the ECMA 262 specification.
May 12 2006
parent Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <e42l48$2v2d$1 digitaldaemon.com>, Walter Bright says...
Nicholas Jordan wrote:
 Which regular expression language is the one commonly used ?

It's the same r.e. language defined by the ECMA 262 specification.

Thanx
Jun 18 2006