Char-UHC

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
0.46  2009-12-02 00:00:00
  - fix bug of split q//
  - created by INABA Hitoshi
 
0.45  2009-11-30 00:00:00
  - fix bug of Esjis::split when string is empty
  - created by INABA Hitoshi
 
0.44  2009-11-16 00:00:00
  - support given and when keywords
  - support \gN, \g{N}, and \g{-N} in s///
  - support stacked filetest operators
  - created by INABA Hitoshi
 
0.43  2009-10-12 00:00:00
  - support UTF-2 (aka UTF-8)
  - fix bug of join separated multiple octet of EUCJP, INFOMIXV6ALS, and GB18030
  - created by INABA Hitoshi
 
0.42  2009-09-28 00:00:00
  - rewrite split(m/^/) to split(m/^/m) on any version of perl

lib/Euhc.pm  view on Meta::CPAN

9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
    return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
}
 
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
my $metachar = qr/[\@\\|[\]{^]/oxms;
 
# split regexp
my @char = $string =~ /\G((?>
    [^\x81-\xFE\\\$\@\[\(]|[\x81-\xFE][\x00-\xFF] |
    \\                               (?>[1-9][0-9]*)            |
    \\g (?>\s*)                      (?>[1-9][0-9]*)            |
    \\g (?>\s*) \{ (?>\s*)           (?>[1-9][0-9]*) (?>\s*) \} |
    \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
    \\x                              (?>[0-9A-Fa-f]{1,2})       |
    \\                               (?>[0-7]{2,3})             |
    \\c                              [\x40-\x5F]                |
    \\x\{                            (?>[0-9A-Fa-f]+)        \} |
    \\o\{                            (?>[0-7]+)              \} |
    \\[bBNpP]\{                      (?>[^\x81-\xFE0-9\}][^\x81-\xFE\}]*) \} |
    \\ $q_char                           |
    \$` | \$\{`\} | \$ (?>\s*) PREMATCH  | \$ (?>\s*) \{ (?>\s*) PREMATCH  (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\}  |
    \$& | \$\{&\} | \$ (?>\s*) MATCH     | \$ (?>\s*) \{ (?>\s*) MATCH     (?>\s*) \} | \$ (?>\s*) \{\^MATCH\}     |
                    \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |

lib/Euhc.pm  view on Meta::CPAN

9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
        }
    }
}
elsif ($char[$i] eq '\E') {
}
 
# \0 --> \0
elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
}
 
# \g{N}, \g{-N}
 
# P.108 Using Simple Patterns
# in Chapter 7: In the World of Regular Expressions
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
 
# P.221 Capturing
# in Chapter 5: Pattern Matching
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
 
# \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
}
 
# \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
    if ($1 <= $parens) {
        $char[$i] = '\\g{' . ($1 + 1) . '}';
    }
}
 
# \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
    if ($1 <= $parens) {
        $char[$i] = '\\g' . ($1 + 1);
    }
}
 
# \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
    if ($1 <= $parens) {
        $char[$i] = '\\' . ($1 + 1);
    }
}



( run in 0.498 second using v1.01-cache-2.11-cpan-0d8aa00de5b )