C++ Builder 2009 UnicodeString Regular Expressions

1.3k Views Asked by At

Curious of anyone knows of an easy, quick way to do regular expressions using UnicodeString in C++ Builder 2009.

Particularly for an IPv4 IP address.

1

There are 1 best solutions below

1
On

Use DEELX Regular Expression Engine, I have written a BCB wrapper for it and downloadable from here (Independent single header).

char *text = "My ip is 212.122.090.180";
TMatchResult result;
TRegex <char> regex("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b", IGNORECASE);
result = regex.Match(text, 0);
if(result.isMatched())
    printf("Found at %i-%i", result.start, result.length);
else
    printf("Not found.");