Results 1 to 2 of 2

Thread: Question about a doubt in Regular Expression – RWCRegexp class

  1. #1
    Junior Member
    Join Date
    Jan 2009

    Post Question about a doubt in Regular Expression – RWCRegexp class

    #include all necess... headers

    RWCString aString("AA098765");

    RWCRegexp reg("^[A-Z]{2}[0-9]{6}$");

    cout << "Rx = " << aString(reg) << endl;
    Rx =

    I am new to RWCRegexp class.
    I run the above program, but I didn’t get the output. Please explain why I am not getting the output. Thank in advance.

    Is the RegEX is correct, i need to accept only the string with the given regexp format. Please help me ASAP

  2. #2
    Join Date
    Feb 2008
    The class RWCRegex does not have the { } parameter defined in the class. You will need to use the RWTRegex<T> class to use the {} functionality. Here is a sample of the code you have using the RWTRegex<T> class:

    #include <iostream>
    #include <rw/cstring.h>
    #include <rw/tools/regex.h>

    int main()
    RWCString a("AA098765");
    RWTRegex<char> re("^[A-Z]{2}[0-9]{6}$");
    RWTRegexResult<char> result;
    result =;
    std::cout << "result: " << result.subString(a) << std::endl;

    return 0;

    This is the output as expected:
    result: AA098765

    Jeremy Dean
    Rogue Wave Software
    Technical Support

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts