| | |
| | |
| | |
| | Enter the string that you want to use a regular expression on: |
|
| | Select the elements that you want to extract to run regular expression generator: |
2 | | What to click? | extract any integer in this position |  | extract this integer (2006) in this position |
| |
|
| |
3 | | Perl regular expression program that extracts the selected elements from the entered string: |
| | | | |
#!/usr/bin/perl
$txt='42 43';
$re1='(4)';
$re2='(2)';
$re3='(.)';
$re4='(\\d+)';
$re=$re1.$re2.$re3.$re4;
if ($txt =~ m/$re/is)
{
$c1=$1;
$c2=$2;
$c3=$3;
$int1=$4;
print "($c1) ($c2) ($c3) ($int1) \n";
}
| | |
|
|
  |