Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
my $num = '(123) 234-3456 ext. 45678';
my @parts = $num =~ /(\d+)/g;
print "$_ " for @parts; # just proof that it worked
my @parts = $num =~ /\d+/g;
$ExampleNumber = '(123) 123-1234 ext. 12345';
if ($ExampleNumber =~ m|[(]?(\d{3})[)][ ]?(\d{3}\d?)[-](\d{4})[ ][ext.][ ](\d{5})|g) {
$ExampleNumber1PFix1 = $1;
$ExampleNumber1PFix2 = $2;
$ExampleNumber1PFix3 = $3;
$ExampleNumber1PFix4 = $4;
}
print "Just to try \n";
print "$ExampleNumber1PFix1, $ExampleNumber1PFix2 , $ExampleNumber1PFix3 , $ExampleNumber1PFix4 \n";
my @parts = $num =~ /\d+/g;
print (@parts == 4)?'hoookayyy!':'yayyaaaa!';
print "\nhawhhaaaat!\n";
# it's my code, and I can reference The Chapelle show in it if I want...
m|[(]?(\d{3})[)][ ]?(\d{3}\d?)[-](\d{4})[ ][a-z.][ ](\d{5})|g
m|
[(]? -> optional open brace ... \(?
(\d{3}) -> 3 digits
[)] -> close brace / why not optional as earlier? ... \)?
[ ]? -> optional space ... just (space - not in a class)?
(\d{3}\d?) -> 3 digits then digit / optional ... (\d{3,4})
[-] -> hyphen ... - (not in class)
(\d{4}) -> 4 digits
[ ] -> space ... (space - not in a class)
[a-z.] -> lowercase 'a' through 'z' AND full-stop [red]guess you need a +[/red]
[ ] -> space ... (space - not in a class)
(\d{5}) -> 5 digits
|g
m|
\(? [red](escaped) open paren - [b]optional[/b][/red]
(\d{3}) [red]3 digits[/red]
\)? [red](escaped) closed paren - [b]optional[/b][/red]
? [red]space - [b]optional[/b][/red]
(\d{3,4}) [red]min of 3 / max of 4 digits[/red]
- [red]hyphen[/red]
(\d{4}) [red]4 digits[/red]
[red]space[/red]
[a-z.]+ [red]'a' through 'z' AND full-stop / one or more of these[/red]
[red]space[/red]
(\d{5}) [red]5 digits[/red]
|g;
$phone =~ m|(\d{3})[^\d]+(\d{3,4})[^\d]+(\d{4})[^\d]+(\d{5})|g;
(\d{3}) -> [blue]3 digits - [b]fixed[/b][/blue]
[^\d]+ -> [blue]catch anything that isn't a digit[/blue]
(\d{3,4}) -> [blue]min of 3 digits - max of 4[/blue]
[^\d]+ -> [blue]catch anything that isn't a digit[/blue]
(\d{3}) -> [blue]4 digits - [b]fixed[/b][/blue]
[^\d]+ -> [blue]catch anything that isn't a digit[/blue]
(\d{3}) -> [blue]5 digits - [b]fixed[/b][/blue]
$line1 = "193 03989337 000060003+00060009.69003858";
$line2 = "195 989337 000060003+00060009.69003858";
@line1split = split (//, $line1);
@line2split = split (//, $line2);
$line1Length = @line1split;
print "number of characters: $line1Length\n\n";
$valuePerChar = 100 / $line1Length;
print "score per character match: $valuePerChar %\n\n";
for ($x=0; $x<=$#line1split; $x++) {
if ($line1split[$x] eq $line2split[$x]) {
$matched = $matched + $valuePerChar;
print "$line1split[$x] | $line2split[$x] ... (match) $matched %\n"
} else {
print "$line1split[$x] | $line2split[$x] ... $matched %\n"
}
}
number of characters: 44
score per character match: 2.27272727272727 %
1 | 1 ... (match) 2.27272727272727 %
9 | 9 ... (match) 4.54545454545455 %
3 | 5 ... 4.54545454545455 %
| ... (match) 6.81818181818182 %
| ... (match) 9.09090909090909 %
| ... (match) 11.3636363636364 %
| ... 11.3636363636364 %
0 | ... 11.3636363636364 %
3 | ... 11.3636363636364 %
9 | 9 ... (match) 13.6363636363636 %
8 | 8 ... (match) 15.9090909090909 %
9 | 9 ... (match) 18.1818181818182 %
3 | 3 ... (match) 20.4545454545455 %
3 | 3 ... (match) 22.7272727272727 %
7 | 7 ... (match) 25 %
| ... (match) 27.2727272727273 %
| ... (match) 29.5454545454546 %
0 | 0 ... (match) 31.8181818181818 %
0 | 0 ... (match) 34.0909090909091 %
0 | 0 ... (match) 36.3636363636364 %
0 | 0 ... (match) 38.6363636363636 %
6 | 6 ... (match) 40.9090909090909 %
0 | 0 ... (match) 43.1818181818182 %
0 | 0 ... (match) 45.4545454545455 %
0 | 0 ... (match) 47.7272727272727 %
3 | 3 ... (match) 50 %
+ | + ... (match) 52.2727272727273 %
0 | 0 ... (match) 54.5454545454546 %
0 | 0 ... (match) 56.8181818181818 %
0 | 0 ... (match) 59.0909090909091 %
6 | 6 ... (match) 61.3636363636364 %
0 | 0 ... (match) 63.6363636363636 %
0 | 0 ... (match) 65.9090909090909 %
0 | 0 ... (match) 68.1818181818182 %
9 | 9 ... (match) 70.4545454545455 %
. | . ... (match) 72.7272727272727 %
6 | 6 ... (match) 75 %
9 | 9 ... (match) 77.2727272727273 %
0 | 0 ... (match) 79.5454545454545 %
0 | 0 ... (match) 81.8181818181818 %
3 | 3 ... (match) 84.0909090909091 %
8 | 8 ... (match) 86.3636363636363 %
5 | 5 ... (match) 88.6363636363636 %
8 | 8 ... (match) 90.9090909090908 %