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
day
int42
_
c _
ws
4
c 4
d4
3
c 3
d3
day3
int
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3C++.net 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-c++dotnet.php3?s=42%2043&2&3&5

#include "stdafx.h"
using namespace System;
using namespace System::Text::RegularExpressions;

int main()
{
  String^ txt="42 43";

  String^ re1=".*?";	// Non-greedy match on filler
  String^ re2="(?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))(?![\\d])";	// Uninteresting: day
  String^ re3="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])";	// Day 1
  String^ re4="(\\s+)";	// White Space 1
  String^ re5="(\\d+)";	// Integer Number 1

  Regex^ r = gcnew Regex(re1+re2+re3+re4+re5,RegexOptions::IgnoreCase|RegexOptions::Singleline);
  Match^ m = r->Match(txt);
  if (m->Success)
  {
      String^ day1=m->Groups[1]->Captures[0]->ToString();
      String^ ws1=m->Groups[2]->Captures[0]->ToString();
      String^ int1=m->Groups[3]->Captures[0]->ToString();
      Console::Write("("+day1->ToString()+")"+"("+ws1->ToString()+")"+"("+int1->ToString()+")"+"\n");
  }
  Console::ReadLine();
}

//-----
// Paste the code into a new Console Application
//-----
 
 
 
 
Feedback
Sikandar:: One of the most helpul tool ever i have seen on the net,,,, Hats offThu, 2 May 2013 06:25AM
::  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
:: greatFri, 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 freeSat, 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:: AwesomeThu, 9 May 2013 02:46AM
:: ThanksThu, 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 pleaseSun, 12 May 2013 05:22PM
ron:: mark, this is awesome!Sun, 12 May 2013 08:57PM
:: Bitch please, you must have a mental diseaseMon, 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!Mon, 13 May 2013 12:44PM
::  Mon, 13 May 2013 02:28PM
:: Best of the bestTue, 14 May 2013 06:14AM
Anup:: The best I ever useTue, 14 May 2013 06:26AM
Ruben:: Great stuff!!Tue, 14 May 2013 02:49PM
::  Tue, 14 May 2013 04:39PM
::  Tue, 14 May 2013 07:32PM
:: Nice! Where's the "donate" link!Tue, 14 May 2013 07:33PM
h:: hWed, 15 May 2013 02:56PM
::  Wed, 15 May 2013 05:02PM
slevin:: Mind blowing. Missing Objective-c, though!Wed, 15 May 2013 06:35PM
Zayed:: THANKS A LOT!!!!!!!Thu, 16 May 2013 05:35PM
::  Thu, 16 May 2013 06:36PM
:: awesome tool!!! thanks from brazilThu, 16 May 2013 06:38PM
:: goodFri, 17 May 2013 08:25AM
Ad:: Just want I needed.. 2 Thrubms upFri, 17 May 2013 12:55PM
NEO:: Awesome, wish I found this years ago!Fri, 17 May 2013 06:36PM
 
  home     faq              ©2006 mark james ennis