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
2
c 2
d2
0
c 0
d0
day20
20
:
c :
A
c A
wA
p
c p
wp
r
c r
wr
usstatepr
varApr
Apr
monthApr
:
c :
2
c 2
d2
0
c 0
d0
1
c 1
d1
3
c 3
d3
day13
year2013
int2013
ddmmmyyyy20:Apr:2013
_
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:
[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=20:Apr:2013%20%22This%20is%20an%20Example!%22&-1&-10&-12
$txt='20:Apr:2013 "This is an Example!"';
$re1='(20)';	# Integer Number 1
$re2='.*?';	# Non-greedy match on filler
$re3='(Apr)';	# Word 1
$re4='.*?';	# Non-greedy match on filler
$re5='("This is an Example!")';	# Double Quote String 1
$re=$re1.$re2.$re3.$re4.$re5;
if ($txt =~ m/$re/is)
{
    $int1=$1;
    $word1=$2;
    $string1=$3;
    print "($int1) ($word1) ($string1) \n";
}
#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
 
 
Feedback
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
:: nonsenseSun, 19 May 2013 05:44PM
kichwa_kibov:: lifesaverMon, 20 May 2013 02:53PM
I just...:: jizzed myself. This rocks!Tue, 21 May 2013 03:59AM
fastnfurious:: thank you!Tue, 21 May 2013 04:45AM
@JohnSReid:: Absolutely incredibleTue, 21 May 2013 04:53PM
Menzo:: ThanksWed, 22 May 2013 12:32PM
:: excellent![/mrburns] too bad that there's no brainfuck-support thoughThu, 23 May 2013 08:25AM
::  Thu, 23 May 2013 09:06AM
::  Thu, 23 May 2013 09:06AM
::  Thu, 23 May 2013 02:34PM
Espresso:: you saved my life from Thu, 23 May 2013 02:35PM
Praveen:: Awesome toolFri, 24 May 2013 06:44AM
Damian Blanc:: Thanks a lot, you are great!!!Fri, 24 May 2013 10:11AM
M.Rahi:: You tried very well ! ������thank you :)Sat, 25 May 2013 04:19PM
rdrabdexps:: WJihoCQsxviCMDVSat, 25 May 2013 10:33PM
 
  home     faq              ©2006 mark james ennis