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)
x
 
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 :
M
c M
wM
a
c a
wa
y
c y
wy
varMay
May
monthMay
:
c :
2
c 2
d2
0
c 0
d0
1
c 1
d1
2
 2
d2
day12
year2012
int2012
ddmmmyyyy02:May:2012
_
c _
_
"
c "
T
c T
wT
h
c h
wh
i
c i
wi
s
c s
ws
varThis
wordThis
_
c _
ws_
i
c i
wi
s
c s
ws
varis
wordis
_
c _
ws_
a
c a
wa
n
c n
wn
varan
wordan
_
c _
ws_
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 "
"This_is_an_Example!"
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Perl regular expression program that extracts the selected elements from the entered string:
Zombie Strippers
[Perl] PHP Python Java Javascript ColdFusion C C++ Ruby VB VBScript J#.net C#.net C++.net VB.net 
 
#!/usr/bin/perl
# URL that generated this code:
# http://txt2re.com/index.php3?s=02:May:2012%20%22This%20is%20an%20Example!%22&-1&-59&-19&-10
$txt='02:May:2012 "This is an Example!"';
$re1='.*?';	# Non-greedy match on filler
$re2='(May)';	# Word 1
$re3='.*?';	# Non-greedy match on filler
$re4='2';	# Uninteresting: c
$re5='.*?';	# Non-greedy match on filler
$re6='(2)';	# Any Single Character 1
$re7='( )';	# White Space 1
$re8='("This is an Example!")';	# Double Quote String 1
$re=$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8;
if ($txt =~ m/$re/is)
{
    $word1=$1;
    $c1=$2;
    $ws1=$3;
    $string1=$4;
    print "($word1) ($c1) ($ws1) ($string1) \n";
}
#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
 
 
Feedback
ouiji:: am are will pay to have this also convert out into Pascal/Delphi/Laz. Amazing work.Thu, 30 Aug 2012 01:37AM
Carlos Armenta:: Thanks for save me a lot of time...!!!Thu, 30 Aug 2012 03:27AM
Arvin::  Very good!Fri, 31 Aug 2012 02:28AM
:: g8Mon, 3 Sep 2012 11:06AM
Gareth Chidgey:: OMG!!!!!!! This is amazing, best find all year.Mon, 3 Sep 2012 03:14PM
john:: Genus.Tue, 4 Sep 2012 01:55PM
bibhu:: good oneWed, 5 Sep 2012 07:38AM
SkyNetBCN:::: Great! Simply greatThu, 6 Sep 2012 06:44AM
clem:: the best tool for regex everThu, 6 Sep 2012 06:40PM
:: I am so happy this exists.Thu, 6 Sep 2012 08:55PM
Rags:::: Awesome.Fri, 7 Sep 2012 05:30PM
poopybutt:: I, also, am giving positive feedback for such a tool's inception.Fri, 7 Sep 2012 06:40PM
mijaved:: Great job!!!Sun, 9 Sep 2012 06:14AM
:: alert("Leuk hoor!");Sun, 9 Sep 2012 03:33PM
:: This thing is great, I get regex help, and a link to Zombie Strippers... awesome!Mon, 10 Sep 2012 03:55PM
:: LOVEMon, 10 Sep 2012 04:52PM
:: would love to be able to host this on my own local server. i hope this site never goes down ;-)Mon, 10 Sep 2012 04:53PM
MChandler:: This is the greatest thing since sliced bread.Tue, 11 Sep 2012 06:05PM
Alex:: Thank you very much! Love it :-)Tue, 11 Sep 2012 06:49PM
workstation37:: '(Thank)'+'(\\s+)'+'(You)'Wed, 12 Sep 2012 11:58AM
Ruslan:: Stunningly!!!!!!!Wed, 12 Sep 2012 12:47PM
:: niceWed, 12 Sep 2012 05:47PM
:: GENIALE!!! ;)Sun, 16 Sep 2012 10:38AM
:: This saved me tons of time!Sun, 16 Sep 2012 07:54PM
::  Mon, 17 Sep 2012 03:55AM
::  Mon, 17 Sep 2012 03:55AM
::  Mon, 17 Sep 2012 03:57AM
::  Mon, 17 Sep 2012 03:57AM
::  Mon, 17 Sep 2012 09:12AM
::  Mon, 17 Sep 2012 10:53AM
tehdog:: naahahaaaiceMon, 17 Sep 2012 03:47PM
::  Mon, 17 Sep 2012 03:47PM
:: awesome you rock!Mon, 17 Sep 2012 07:52PM
:: I love you in the most hetero way.Mon, 17 Sep 2012 11:53PM
::  Mon, 17 Sep 2012 11:56PM
:: great piece of work, saved lotz of time:)Tue, 18 Sep 2012 09:33AM
::  Tue, 18 Sep 2012 08:37PM
youngrobot.com:: Perfect! Made it easy to create regular expressions for active directory!Tue, 18 Sep 2012 08:38PM
xx:: 钓鱼岛管我鸟事...Wed, 19 Sep 2012 04:11AM
xx:: 钓鱼岛管我鸟事...Wed, 19 Sep 2012 04:12AM
:: The island of diaoyu is none of my business...Wed, 19 Sep 2012 04:17AM
Varun:: This site rocks \m/Wed, 19 Sep 2012 10:35AM
:: This is a great idea and makes making regular expressions a breeeze. ThanksWed, 19 Sep 2012 08:09PM
:: aadsasdThu, 20 Sep 2012 03:24AM
 
  home     faq