Skip to content

Commit 6e33e61

Browse files
committed
Word/punctuation split improved to avoid treating punctuation and newline symbols as part of the word.
1 parent cffb32d commit 6e33e61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Text/WordDiff.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $VERSION = '0.08';
1010

1111
# _Mastering Regular Expressions_, p. 132.
1212
my $BEGIN_WORD = $] >= 5.006
13-
? qr/(?<!\p{IsWord})(?=\p{IsWord})/msx
13+
? qr/(?:(?<!\p{IsWord})(?=\p{IsWord})|(?<!\p{IsPunct})(?=\p{IsPunct})|(?<!\p{IsCntrl})(?=\p{IsCntrl}))/msx
1414
: qr/(?<!\w)(?=\w)/msx;
1515

1616
my %styles = (

0 commit comments

Comments
 (0)