txt 2 re
        headache relief for programmers :: 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
0
c 0
d0
2
c 2
d2
day02
int02
:
c :
A
c A
wA
p
c p
wp
r
c r
wr
usstatepr
varApr
wordApr
monthApr
:
c :
2
c 2
d2
0
c 0
d0
0
c 0
d0
8
c 8
d8
day08
year2008
int2008
ddmmmyyyy
Â
c Â
 
c  
"
c "
T
c T
wT
h
c h
wh
i
c i
wi
s
c s
ws
varThis
wordThis
Â
c Â
 
c  
i
c i
wi
s
c s
ws
varis
wordis
Â
c Â
 
c  
a
c a
wa
n
c n
wn
varan
wordan
Â
c Â
 
c  
E
c E
wE
x
c x
wx
a
c a
wa
m
c m
wm
p
c p
wp
l
c l
wl
e
c e
we
varExample
wordExample
!
c !
"
c "
string"This is an Example!"
< 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://www.txt2re.com/index-csharp.php3?s=02:Apr:2008%C2%A0%22This%C2%A0is%C2%A0an%C2%A0Example!%22&2

using System;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      string txt="02:Apr:2008 \"This is an Example!\"";

      string re1="((?:(?:[0-2]?\\d{1})|(?:[3][0,1]{1}))[-:\\/.](?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)[-:\\/.](?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])";	// DDMMMYYYY 1

      Regex r = new Regex(re1,RegexOptions.IgnoreCase|RegexOptions.Singleline);
      Match m = r.Match(txt);
      if (m.Success)
      {
            String ddmmmyyyy1=m.Groups[1].ToString();
            Console.Write("("+ddmmmyyyy1.ToString()+")"+"\n");
      }
      Console.ReadLine();
    }
  }
}

//-----
// Paste the code into a new Console Application
//-----
plain text version of code
 
 
 
 
Feedback
kevin:: amazing! you are amazing!!Tue, 3 Aug 2010 07:31PM
alex:: thank you again! great tool!Tue, 3 Aug 2010 10:25PM
steven:: Thanks guys!Wed, 4 Aug 2010 12:17AM
SD:: what a tool man thanksWed, 4 Aug 2010 06:47AM
Tony Stark:: GR8 toolWed, 4 Aug 2010 06:48AM
agnese:: Greatest tool everThu, 5 Aug 2010 12:09AM
Lonely girl:: I love you.Thu, 5 Aug 2010 10:46AM
:: i dot understand this lolzThu, 5 Aug 2010 12:12PM
anonx174:: You should receive an award for this website. Seriously.Mon, 9 Aug 2010 11:22PM
cuono:: I present to you the ultimate award for helping mankind. It is guilded in gold or platinum and exists somewhere near Betelgeuse. Thanks for the great tool!Wed, 11 Aug 2010 09:12PM
Lonely boy:: I love you too Lonely girlThu, 12 Aug 2010 08:19AM
coder:: you lols - stuped toolThu, 12 Aug 2010 12:17PM
fan boy:: OMG OMG OMG OMG OMGFri, 13 Aug 2010 02:55AM
Alex:: thank you so much! i agree on the "ultimate award for helping mankind".Sat, 14 Aug 2010 02:28AM
outime:: Best tool in the world. Would be f****** awesome if you make it open-source to have it stored locally (offline)Sat, 14 Aug 2010 04:06AM
paul:: this site is the best site on earth!!!!!!!!!!!!!!!!!!!!!!!!!!Sat, 14 Aug 2010 08:53AM
ClusterOne:: wow, very helpful ... awsome!Sat, 14 Aug 2010 07:30PM
jkFF:: badly need this thanks!!! great job!!!Mon, 16 Aug 2010 07:08AM
ericlee:: amazingMon, 16 Aug 2010 08:05AM
Chris:: Awesome, thanks!Tue, 17 Aug 2010 03:55PM
Hendra:: Subhanallah, amazing.... Great job...!!!Tue, 17 Aug 2010 05:06PM
pdh:: amazing, saved me a bunch of time on tedious matchesWed, 18 Aug 2010 06:34PM
RubyFan:: Love thisThu, 19 Aug 2010 03:35PM
12 years old:: I'm 12 and what is this?Thu, 19 Aug 2010 08:45PM
Props:: thank you guys for keeping the headache out of my brain !Fri, 20 Aug 2010 02:08PM
mark:: yup really a wonderfull tool!Mon, 23 Aug 2010 01:00PM
py:: very thx for your website it's very helpfulTue, 24 Aug 2010 05:24PM
wrathtaker:: wahaw!!!!!Wed, 25 Aug 2010 07:10PM
bradyboy:: just amazingThu, 26 Aug 2010 03:47PM
george n.:: Thats amazing man, very very usefulThu, 26 Aug 2010 07:33PM
Zorro:: You saved me. You deserve a bawlz energy drink.Thu, 26 Aug 2010 11:14PM
kamm:: Thanks for sharing this with the world :)Fri, 27 Aug 2010 12:01PM
Kavinsky:: The best tool i found this year!Fri, 27 Aug 2010 06:10PM
yo yo:: life-saver, innt'it?Sun, 29 Aug 2010 06:09PM
xxiyxhmrf:: BXoRwCDVQQtWSckSun, 29 Aug 2010 07:50PM
chromosome (\d+|\w+)::  Mon, 30 Aug 2010 10:34AM
:: cocksTue, 31 Aug 2010 05:42AM
:: You should definitly make an offline version of this, Great stuff!!Tue, 31 Aug 2010 01:22PM
:: Thanks so much, if there would be a donate Button, I would donate!Tue, 31 Aug 2010 06:21PM
dique:: cock headsWed, 1 Sep 2010 12:48AM
mrithu:: nice !if php preg_match used it will be more helpfulWed, 1 Sep 2010 01:50PM
Wander:: Great one!Thu, 2 Sep 2010 08:16AM
fsd:: fsdfThu, 2 Sep 2010 11:36AM
FF:: One of the most useful regex tools I have seen to date.Thu, 2 Sep 2010 08:22PM
 
  home     faq