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
int20
:
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&-18&-10&-1
$txt='20:Apr:2013 "This is an Example!"';
$re1='.*?';	# Non-greedy match on filler
$re2='(Apr)';	# Word 1
$re3='.*?';	# Non-greedy match on filler
$re4='("This is an Example!")';	# Double Quote String 1
$re5='(an)';	# Variable Name 1
$re=$re1.$re2.$re3.$re4.$re5;
if ($txt =~ m/$re/is)
{
    $word1=$1;
    $string1=$2;
    $var1=$3;
    print "($word1) ($string1) ($var1) \n";
}
#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
 
 
Feedback
�������:: ���������, �������! �� �� �������������, ��� ����� ���!Mon, 8 Apr 2013 10:44PM
Krishna:: I love you, I love you so much!!!Mon, 8 Apr 2013 11:46PM
:: Thank you! very handy!Tue, 9 Apr 2013 02:17PM
:: cool nice one!Tue, 9 Apr 2013 02:43PM
saira:: AwesomeFri, 12 Apr 2013 06:46AM
psk:: Fuki'n great, I wanna donate you!!!Mon, 15 Apr 2013 06:20AM
Siddu:: VERY helpful thank youMon, 15 Apr 2013 11:47AM
Nitin:: Great!!!Mon, 15 Apr 2013 01:10PM
:: THX! ::::)Mon, 15 Apr 2013 02:35PM
trev:: dynamiteTue, 16 Apr 2013 03:08AM
Nutn�:: Very fun and usable!Tue, 16 Apr 2013 12:48PM
:: Thank you Wed, 17 Apr 2013 07:39AM
:: Best. Site. Ever.Wed, 17 Apr 2013 10:31AM
hiren:: Nice. Usefull site. Never seen like this... Thanks to developers/owner of this site...Wed, 17 Apr 2013 06:45PM
vijayant:: this tool saved me again. thank youThu, 18 Apr 2013 12:01PM
paolo:: great work! the community appreciatesThu, 18 Apr 2013 04:34PM
stella:: do you know how to do this for coda? Thank you so much! Fri, 19 Apr 2013 12:39AM
:: oh my god u are the best manFri, 19 Apr 2013 02:38PM
:: goodSun, 21 Apr 2013 05:25AM
That Family Guy:: OMG Awesome!!!! Best ever episode! Fast and simple!Sun, 21 Apr 2013 09:06PM
amiag:: fkin awesomeMon, 22 Apr 2013 06:52PM
comfreak:: Damn, nice!Tue, 23 Apr 2013 08:11AM
mrclark:: Wow.Tue, 23 Apr 2013 12:27PM
:: awk, please!Tue, 23 Apr 2013 01:49PM
StarD:: Beautiful !Wed, 24 Apr 2013 05:06PM
yuom:: life / time saver!Wed, 24 Apr 2013 06:05PM
lss:: dsdsWed, 24 Apr 2013 10:00PM
::  Wed, 24 Apr 2013 10:00PM
::  Thu, 25 Apr 2013 12:27PM
:: Thanks alot man, best site everThu, 25 Apr 2013 01:02PM
::  Thu, 25 Apr 2013 06:18PM
cmark:: This is a very slick site. thanks!Thu, 25 Apr 2013 07:24PM
TJune:: asesome!!! Thk Fri, 26 Apr 2013 01:59AM
Joan Comas:: At the beginning is a little bit confusing, but absolutely necessary!Fri, 26 Apr 2013 07:27AM
twtjtfsm:: KeSASYtSTFri, 26 Apr 2013 12:36PM
NinjaTux:: congrats, this is an awesome tools!thank youFri, 26 Apr 2013 12:37PM
::  Fri, 26 Apr 2013 03:41PM
::  Sat, 27 Apr 2013 04:43AM
:: didin't quite get it at first, but then... oh. my. god.Sun, 28 Apr 2013 04:30PM
lub:: FUCK REGEXSun, 28 Apr 2013 07:32PM
argshook:: this is incredible!Mon, 29 Apr 2013 12:29AM
_ThankYou_:: Jesus Christ, THX!Tue, 30 Apr 2013 10:29AM
Ryk:: Saved me so much time, thank youTue, 30 Apr 2013 06:31PM
ftrotter:: Your autogenerated php regex for timestamps fails with the input 2013-03-01 2:34:54" because it is looking for two digits in the hour slot of the time. Thanks so much for this site!!Wed, 1 May 2013 01:14PM
 
  home     faq              ©2006 mark james ennis