Skip to content

Instantly share code, notes, and snippets.

@fjyuu fjyuu/
Created May 5, 2012

What would you like to do?
分かち書きしないっぽい文字を表す正規表現(User-Defined Character Properties)
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010;
binmode STDOUT, ":utf8";
my $text = "これはpenです";
$text =~ s/(\p{IsNonSpacingCharacter})([^\p{IsNonSpacingCharacter}])/$1 $2/g;
$text =~ s/([^\p{IsNonSpacingCharacter}])(\p{IsNonSpacingCharacter})/$1 $2/g;
say $text; # これは pen です
sub IsNonSpacingCharacter {
return <<'END';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.