txt 2 re
knowing is obsolete :: regular expression generator (perl php python java javascript coldfusion c c++ ruby vb vbscript j# c# c++.net vb.net)
 
 
 
Enter the string that you want to use a regular expression on:
1
   
 
Select the elements that you want to extract to run regular expression generator:
2
4
c 4
d4
2
c 2
d2
day2
int42
_
c _
ws_
4
c 4
d4
3
c 3
d3
day3
int43
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3C regular expression program that extracts the selected elements from the entered string:
Perl PHP Python Java Javascript ColdFusion [C] C++ Ruby VB VBScript J#.net C#.net C++.net VB.net 
 
// URL that generated this code:
// http://txt2re.com/index-cpcre.php3?s=42%2043&2&3&9999

#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[]="";	//  1
  strcat(re,re1);
  char re2[]=".*?";	// Non-greedy match on filler
  strcat(re,re2);
  char re3[]="(?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))(?![\\d])";	// Uninteresting: day
  strcat(re,re3);
  char re4[]="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])";	// Day 1
  strcat(re,re4);
  char re5[]=".*?";	// Non-greedy match on filler
  strcat(re,re5);
  char re6[]="(\\d+)";	// Integer Number 1
  strcat(re,re6);

  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 1[1024];
      pcre_copy_substring(txt, ovector, rc,1,1, 1024);
      printf("(%s)",1);
      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
::  Wed, 10 Sep 2014 04:40AM
gfpucoclw:: GnlZsZhtESAzThu, 11 Sep 2014 05:21AM
What:: Happened Thu, 11 Sep 2014 09:32AM
in :: Chicago on this day?Thu, 11 Sep 2014 09:33AM
Thank you:: Thank youThu, 11 Sep 2014 09:34AM
Thank you:: Thank youThu, 11 Sep 2014 10:34AM
I:: Love herThu, 11 Sep 2014 10:34AM
I:: Love herThu, 11 Sep 2014 10:37AM
amil:: eman reh siThu, 11 Sep 2014 11:42AM
::  Thu, 11 Sep 2014 02:29PM
m:: wow this is sick!Thu, 11 Sep 2014 02:30PM
理漯彘::  Thu, 11 Sep 2014 06:51PM
:: +49 (9879) 789568658Thu, 11 Sep 2014 07:25PM
it's me:: lame regex generator. worthlessFri, 12 Sep 2014 01:08AM
:: 2321dsfaasFri, 12 Sep 2014 03:13AM
swagoverflow:: simply the bestFri, 12 Sep 2014 07:01AM
理漯彘 妈牝铕钼梓::  Fri, 12 Sep 2014 09:40AM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:15PM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:17PM
www.baidu.com/link?url=::  Fri, 12 Sep 2014 03:18PM
中国:: 不错,到些一游!Sat, 13 Sep 2014 07:44AM
中国:: 不错,到些一游!Sat, 13 Sep 2014 07:44AM
lqlyybctfn:: sVGDWVUHeZJQAcRvHPSat, 13 Sep 2014 09:55AM
::  Sat, 13 Sep 2014 08:29PM
dmitry:: that a cool tool thanks :)!Sat, 13 Sep 2014 09:48PM
:: ");alert("fuck you");Sun, 14 Sep 2014 02:35AM
理漯彘 妈牝铕钼梓::  Sun, 14 Sep 2014 03:30PM
理漯彘 妈牝铕钼梓::  Sun, 14 Sep 2014 07:31PM
oi:: javascript:alert("fix me");Mon, 15 Sep 2014 10:50AM
::  Tue, 16 Sep 2014 05:35AM
:: you guys are fucking losers, piss off with your inject attempts.Tue, 16 Sep 2014 06:47AM
::  Tue, 16 Sep 2014 08:07AM
:: NOT HELPFUL !!!Tue, 16 Sep 2014 08:07AM
:: It compares character by character and does not give any generic result.. so basically REGEX given by u is specific to that particular string..Tue, 16 Sep 2014 08:08AM
::  Tue, 16 Sep 2014 11:25AM
:: @[User:1638|Sushant Dua]​​ Tue, 16 Sep 2014 11:38AM
Geek AK:: ArgentinaaWed, 17 Sep 2014 04:53AM
ET:: Saved my dayWed, 17 Sep 2014 07:37AM
:: javascript:alert("fix me");Wed, 17 Sep 2014 01:04PM
:: javascript:alert("fix me");Wed, 17 Sep 2014 01:05PM
88::  Wed, 17 Sep 2014 02:12PM
Brazilian Guy:: Don't work for me.Wed, 17 Sep 2014 08:31PM
::  javascript:alert("fix me");Thu, 18 Sep 2014 05:07PM
as:: safFri, 19 Sep 2014 04:24AM
 
  home     faq              ©2006 mark james ennis