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
S
c S
S
f
c 
wf
a
c 
wa
v
c 
wv
o
c 
wo
r
c 
wr
G
c G
G
l
c 
wl
a
c 
wa
e
c 
we
r
c 
wr
s
c 
ws
varSfavorGlaers
wordSfavorGlaers
< 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-perl.php3?s=SfavorGlaers&-4&-3&20&17&26&22&23&21&18&19&24&25

$txt='SfavorGlaers';

$re1='(S)';	# Any Single Word Character (Not Whitespace) 1
$re2='(.)';	# Any Single Character 1
$re3='(.)';	# Any Single Character 2
$re4='(.)';	# Any Single Character 3
$re5='(.)';	# Any Single Character 4
$re6='(.)';	# Any Single Character 5
$re7='(G)';	# Any Single Word Character (Not Whitespace) 2
$re8='(.)';	# Any Single Character 6
$re9='(.)';	# Any Single Character 7
$re10='(.)';	# Any Single Character 8
$re11='(.)';	# Any Single Character 9
$re12='(.)';	# Any Single Character 10

$re=$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8.$re9.$re10.$re11.$re12;
if ($txt =~ m/$re/is)
{
    $w1=$1;
    $c1=$2;
    $c2=$3;
    $c3=$4;
    $c4=$5;
    $c5=$6;
    $w2=$7;
    $c6=$8;
    $c7=$9;
    $c8=$10;
    $c9=$11;
    $c10=$12;
    print "($w1) ($c1) ($c2) ($c3) ($c4) ($c5) ($w2) ($c6) ($c7) ($c8) ($c9) ($c10) \n";
}

#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
 
 
  home     faq              ©2006 mark james ennis