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
4
c 4
d
2
c 2
d2
day2
int42
_
c 
ws_
4
c 4
d4
3
c 3
d3
day3
int
< 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=42%2043&2&-13&10&8

$txt='42 43';

$re1='(\\d)';	# Any Single Digit 1
$re2='.*?';	# Non-greedy match on filler
$re3='.';	# Uninteresting: c
$re4='.*?';	# Non-greedy match on filler
$re5='(.)';	# Any Single Character 1
$re6='(\\d+)';	# Integer Number 1

$re=$re1.$re2.$re3.$re4.$re5.$re6;
if ($txt =~ m/$re/is)
{
    $d1=$1;
    $c1=$2;
    $int1=$3;
    print "($d1) ($c1) ($int1) \n";
}

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