8
0
Просмотр исходного кода

Add description to regular expression.

Mateusz Samsel 6 лет назад
Родитель
Сommit
d3dfa6feb4
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      packages/ckeditor5-word-count/src/wordcount.js

+ 6 - 0
packages/ckeditor5-word-count/src/wordcount.js

@@ -232,6 +232,12 @@ export default class WordCount extends Plugin {
 
 		this.characters = txt.replace( /\n/g, '' ).length;
 
+		// Groups:
+		// {L} - Any kind of letter from any language.
+		// {N} - Any kind of numeric character in any script.
+		// {M} - A character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.).
+		// {Pd} - Any kind of hyphen or dash.
+		// {Pc} - A punctuation character such as an underscore that connects words.
 		const wordsMatch = regExpFeatureDetection.isUnicodePropertySupported ?
 			txt.match( new RegExp( '[\\p{L}\\p{N}\\p{M}\\p{Pd}\\p{Pc}]+', 'gu' ) ) :
 			txt.match( /[_\-a-zA-Z0-9À-ž]+/gu );