Regular Expressions

Previous topic - Next topic

MrTAToad

Found a cross platform regular expression routine (originally found here : http://www.codeproject.com/KB/library/deelx.aspx).  The test code is :

Code (glbasic) Select
INLINE
}

#include "deelx.h"

namespace __GLBASIC__ {
ENDINLINE

FUNCTION test%:
INLINE
char ptn[] = "[abc]b[abc]";
char txt[] = "such as 1, 234, 12.5, .78 etc abc ABC 1BC";

    // declare
    static CRegexpT <char> regexp(ptn,SINGLELINE);

    // loop
    MatchResult result = regexp.Match(txt);

    while( result.IsMatched() )
    {
    DGStr temp;
   
    temp=MID_Str(DGStr(txt),result.GetStart(),result.GetEnd() - result.GetStart());
    DEBUG(temp);
    DEBUG("\n");

        // get next
        result = regexp.Match(txt, result.GetEnd());
    }
ENDINLINE
ENDFUNCTION


The main code is included

[attachment deleted by admin]

Kitty Hello

Can I included these in the "Samples/COMMON" directory for the V8 build? If so, please prepare the files and add a BIG credit line at the very top of it.
Also include a "buy me a beer" link in the source.

... reminds me - that would be a cool option for a gbal library. I need the command:
BUYMEABEER "5.00EUR:myname@myspace.com"
:P

MrTAToad

Yes - should be fine.

Shall I email the stuff to you ?