First, use RegexBuddy to define a regex or retrieve a regexp saved in a RegexBuddy library. Rely on RegexBuddy's clear regex analysis, which is constantly updated as you build the pattern, rather than dealing with the cryptic regex syntax on your own. Detailed help on that syntax is always only a click away.
If you copied a regex written for another programming language, simply paste it into RegexBuddy, select the original language, and then convert the regex to the specific version of PCRE you're using. You can also convert a regex from any PCRE or PCRE2 version to any other PCRE or PCRE2 version. If you're writing a code library that needs to work with multiple versions of PCRE, compare your regex between those PCRE versions to make sure it will work exactly the same with all of them. RegexBuddy knows all the features and all the bugs in all versions of PCRE from PCRE 4.0 (released way back in 2003) all the way to the latest PCRE2 10.22.
If you created a new regular expression, test and debug it in RegexBuddy before using it in your source code. Test each regex in RegexBuddy's safe sandbox without risking precious data. Quickly apply the regex to a wide variety of input and sample data, without having to produce that input through your application.
Finally, let RegexBuddy generate a source code snippet that you can copy and paste directly into whichever IDE or C/C++ code editor you use. Just select your version of PCRE or PCRE2 and choose what you want to use the regex for to instantly get a functional code snippet. You can change the names of variables and parameters to suit your naming style or the current situation, which RegexBuddy automatically remembers.
Don't bother trying to remember the PCRE or PCRE2 function calls and the parameters they require. RegexBuddy's code snippets take care of everything, including setting up a PCRE2 match context when it is needed, compiling the regex with the proper flags, finding the matches with the matching modes you specified, and freeing all allocated memory when done. And don't worry about properly escaping backslashes and quotes. Just tell RegexBuddy what you want to do, and you will get the proper C code straight away.
|Using regular expressions in C and C++ with the PCRE2 regex library|
|Using regular expressions in C and C++ with the PCRE regex library|