// URL that generated this code:
// http://txt2re.com/index-cpcre.php3?s=42%2043&2&3&8
#include <stdio.h>
#include <string.h>
#include <pcre.h>
int main(int argc, char **argv)
{
const char *error;
int erroffset;
int ovector[186];
char re[8192]="";
char txt[]="42 43";
char re1[]="(\\d)"; // Any Single Digit 1
strcat(re,re1);
char re2[]="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])"; // Day 1
strcat(re,re2);
char re3[]=".*?"; // Non-greedy match on filler
strcat(re,re3);
char re4[]="(\\d+)"; // Integer Number 1
strcat(re,re4);
pcre *r = pcre_compile(re, PCRE_CASELESS|PCRE_DOTALL, &error, &erroffset, NULL);
int rc = pcre_exec(r, NULL, txt, strlen(txt), 0, 0, ovector, 186);
if (rc>0)
{
char d1[1024];
pcre_copy_substring(txt, ovector, rc,1,d1, 1024);
printf("(%s)",d1);
char day1[1024];
pcre_copy_substring(txt, ovector, rc,2,day1, 1024);
printf("(%s)",day1);
char int1[1024];
pcre_copy_substring(txt, ovector, rc,3,int1, 1024);
printf("(%s)",int1);
puts("\n");
}
}
//-----
// C does not provide a regular expression feature as standard.
//
// To run this code you will need to first download and install
// the PCRE library from http://www.pcre.org/
//
// Note that on Linux systems PCRE is often already installed in /usr/lib/libpcre* or /usr/local/lib/libpcre*.
//
// Compile and on Unix using:
// # gcc -lpcre x.c
// # ./a.out
//
 
Feedback
::
Fri, 3 May 2013 12:07AM
Gonzalo Oviedo::
Man you are awesome!!!. Congratulation Excelente Maldita Aplicacion!!!!
Fri, 3 May 2013 12:08AM
troncologne::
I'll name my first child after you. I love this tool.
Fri, 3 May 2013 09:14AM
::
Star-12-########
Fri, 3 May 2013 01:26PM
::
great
Fri, 3 May 2013 03:19PM
SmArt::
exactly what i needed :)
Sat, 4 May 2013 11:27AM
jax::
Sir, you made my day :) Awesome work and very nice that its available for free
Sat, 4 May 2013 03:10PM
::
Mon, 6 May 2013 04:06PM
Ynot::
This is the greastest thing since sliced bread!!
Mon, 6 May 2013 10:47PM
::
Ugly site, excellent tool.
Tue, 7 May 2013 04:26PM
FuriousScissors::
Awesome
Thu, 9 May 2013 02:46AM
::
Thanks
Thu, 9 May 2013 07:13AM
Gcankov::
Thank you, kind sir. This is awesome!
Thu, 9 May 2013 11:07AM
bradland::
Love this too sooooo much! Would love an output option that outputs a suitable `grep- E` regex :)
Thu, 9 May 2013 07:50PM
MikeN::
Thanks a lot for putting this out!
Thu, 9 May 2013 08:23PM
µç»°::
Fri, 10 May 2013 04:23AM
takobaba::
thank you, awesome work, awk pls :)
Fri, 10 May 2013 03:56PM
::
Fri, 10 May 2013 04:46PM
::
Fri, 10 May 2013 04:46PM
::
Yes.
Sat, 11 May 2013 09:18PM
exezaid::
bitch please
Sun, 12 May 2013 05:22PM
ron::
mark, this is awesome!
Sun, 12 May 2013 08:57PM
::
Bitch please, you must have a mental disease
Mon, 13 May 2013 12:25AM
::
lving it!
Mon, 13 May 2013 07:56AM
IpSeRc::
Simple, Concise, Usefull, PERFECT. Good App.
Mon, 13 May 2013 10:04AM
::
Round braces detection is not perfect. It skips the ones in middle if there are 2 braces groups. eg: (ab) (ab), it will detect "ab) (ab" in a round braces. At leas in my case.
Mon, 13 May 2013 11:20AM
canners.nl::
Dude: thank you so Much!! Regular Expressions can be such a headache!