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
day
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
c 2
d2
day12
year2012
int2012
ddmmmyyyy02:May:2012
_
c _
ws_
"
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&-67&-21&13&-1&-10
$txt='02:May:2012 "This is an Example!"';
$re1='((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])';	# Day 1
$re2='.*?';	# Non-greedy match on filler
$re3='(May)';	# Word 1
$re4='.*?';	# Non-greedy match on filler
$re5='("This is an Example!")';	# Double Quote String 1
$re6='(a)';	# Any Single Character 1
$re=$re1.$re2.$re3.$re4.$re5.$re6;
if ($txt =~ m/$re/is)
{
    $day1=$1;
    $word1=$2;
    $string1=$3;
    $c1=$4;
    print "($day1) ($word1) ($string1) ($c1) \n";
}
#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
 
 
Feedback
:: Bazi mallarin calistiramadigi generator(!), Kudos!!! Sat, 3 Nov 2012 04:31PM
wv:: exquisite!Sat, 3 Nov 2012 10:11PM
Abhishek:: great work (Y)Sat, 3 Nov 2012 10:59PM
Aphrodice R.:: Wonderfull work!!Mon, 5 Nov 2012 02:56PM
sam:: Wow, that saved me a few hours. Thanks!Mon, 5 Nov 2012 07:35PM
Joe:: neat tool. Thanks so muchMon, 5 Nov 2012 08:56PM
:: nice tool!Tue, 6 Nov 2012 11:24AM
mihai:: Nice job but how do I get the expression for [[]] ? ThanksTue, 6 Nov 2012 11:43AM
mihai:: Nice job but how do I get the expression for [[]] ? ThanksTue, 6 Nov 2012 11:46AM
an::  Tue, 6 Nov 2012 05:47PM
Animatriz:: very usefull thanksTue, 6 Nov 2012 05:48PM
Paul:: Really great free tool! Thanks!Tue, 6 Nov 2012 08:04PM
::  Wed, 7 Nov 2012 02:15AM
Parker:: Outstanding ThanksWed, 7 Nov 2012 02:16AM
::  Wed, 7 Nov 2012 12:12PM
Brandon:: I love this tool very much, I've used it a ton. Am I mistaken in thinking there used to be a link to view the generated code in plaintext? Is that still around?Wed, 7 Nov 2012 12:40PM
very:: niceWed, 7 Nov 2012 06:34PM
Sooooo:: coool, thanksWed, 7 Nov 2012 10:36PM
shayn:: cool, man!Thu, 8 Nov 2012 07:01AM
addy:: this is an awesome tool!!!Thu, 8 Nov 2012 07:38AM
vijayant:: THIS IS AWESOME !!! clearly helped in my appThu, 8 Nov 2012 10:03AM
Peter:: nice tool!Thu, 8 Nov 2012 10:03AM
::  Thu, 8 Nov 2012 06:44PM
::  Thu, 8 Nov 2012 08:23PM
Staab:: The single most useful external coding tool I have yet found.Thu, 8 Nov 2012 08:24PM
::  Fri, 9 Nov 2012 09:37AM
::  Fri, 9 Nov 2012 09:38AM
::  Fri, 9 Nov 2012 11:20AM
Nico:: Thanks for this!Fri, 9 Nov 2012 11:26AM
Radiobuzz:: Great job man, really ! ThanksSat, 10 Nov 2012 03:35PM
::  Tue, 13 Nov 2012 02:46AM
Kevin:: Great tool. Welcome to the most used area of my bookmarks.Tue, 13 Nov 2012 06:26AM
::  Tue, 13 Nov 2012 03:10PM
sunleo:: IT ROCKSSSSSSSSSSSSSSTue, 13 Nov 2012 04:36PM
victor:: The single most useful external coding tool I have yet found.Tue, 13 Nov 2012 09:42PM
����:: Jesus. Helped me so much.Wed, 14 Nov 2012 01:50AM
@:::: g�t�ne koyimWed, 14 Nov 2012 06:52AM
::  Thu, 15 Nov 2012 10:56AM
:: Epic job mateThu, 15 Nov 2012 02:34PM
::  Thu, 15 Nov 2012 02:38PM
::  Thu, 15 Nov 2012 02:39PM
sdfs:: dfsdfsdfThu, 15 Nov 2012 03:12PM
::  Thu, 15 Nov 2012 03:13PM
::  Fri, 16 Nov 2012 09:34AM
 
  home     faq