Created
September 8, 2011 04:29
-
-
Save juliangamble/1202615 to your computer and use it in GitHub Desktop.
Regex comparison
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
#my $text = "\t \t"; | |
#my $text = "\t\t \t"; | |
#my $text = "\t\t \t\t \t"; | |
my $text = "\t\t \t\t \t"; | |
my $text2 = $text; | |
$text2 =~ s{(.*?)\t}{$1.(' ' x (4 - length($1) % 4))}ge; | |
print length($text2); | |
$text2 =~ $text; | |
$text2 =~ s/(.*?)\t/' '/; | |
print length($text2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment