Prototyping Regexps
You can prototype your patterns using existing Perl code or the PCRE tool pcretest. The former is helpful when you're porting an existing Perl app. Be sure to properly escape any sequences for C syntax (such as \S+, which should be \\S+). Specify (optional) input and output files on the command line: pcre [input_file] [output_file]. The first line of the input file is a regular expression, between "/" characters (as in Perl). The remaining lines are tested against the pattern and the results are printed to the output file. For example:
/(?i)foo.*bar/
boofar
foo bar
...
Standard input and standard output are used if the input file or output file, respectively, is not specified.
Use pcretest to ensure PCRE compatibility. PCRE is Perl-like, but it's not 100-percent Perl; not all Perl regexp syntax is supported. As a final note, you can save yourself a lot of recompile time if you load your patterns from external files instead of hard-coding them in your source files.