Skip to content

Commit

Permalink
Merge pull request #21 from mschwerin/master
Browse files Browse the repository at this point in the history
Match unicode characters when comparing for alphanum
  • Loading branch information
rashid2538 committed Nov 6, 2015
2 parents 4b08188 + 643a9e3 commit b8a5a8e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion HtmlDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function ConvertHtmlToListOfWords( $characterString ) {
$current_word = $character;
$mode = 'whitespace';
} else {
if( ctype_alnum( $character ) && ( strlen($current_word) == 0 || ctype_alnum( $current_word ) ) ) {
if( $this->IsAlphaNum( $character ) && ( strlen($current_word) == 0 || $this->IsAlphaNum( $current_word ) ) ) {
$current_word .= $character;
} else {
$words[] = $current_word;
Expand Down Expand Up @@ -165,6 +165,10 @@ private function IsWhiteSpace( $value ) {
return !preg_match( '[^\s]', $value );
}

private function IsAlphaNum( $value ) {
return preg_match( '/[\p{L}\p{N}]+/u', $value );
}

private function Explode( $value ) {
// as suggested by @onassar
return preg_split( '//u', $value );
Expand Down

0 comments on commit b8a5a8e

Please sign in to comment.