简体   繁体   中英

C++ Builder 2009 UnicodeString Regular Expressions

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.

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.");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM