Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Add middle dot #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/twitter-text-conformance
Submodule twitter-text-conformance updated from be88d0 to 34b2fd
10 changes: 9 additions & 1 deletion twitter-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,16 @@
];
addCharsToCharClass(INVALID_CHARS, 0x202A, 0x202E); // Directional change

var SPECIAL_CHARS_INCLUDED = [
fromCode(0x00b7), // MIDDLE DOT
fromCode(0x2022), // BULLET
fromCode(0x30fb), // KATAKANA MIDDLE DOT
fromCode(0xff65), // HALFWIDTH KATAKANA MIDDLE DOT
];

twttr.txt.regexen.spaces_group = regexSupplant(UNICODE_SPACES.join(""));
twttr.txt.regexen.spaces = regexSupplant("[" + UNICODE_SPACES.join("") + "]");
twttr.txt.regexen.special_chars_included = regexSupplant(SPECIAL_CHARS_INCLUDED.join(""));
twttr.txt.regexen.invalid_chars_group = regexSupplant(INVALID_CHARS.join(""));
twttr.txt.regexen.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/;
twttr.txt.regexen.rtl_chars = /[\u0600-\u06FF]|[\u0750-\u077F]|[\u0590-\u05FF]|[\uFE70-\uFEFF]/mg;
Expand Down Expand Up @@ -205,7 +213,7 @@
// A hashtag must contain characters, numbers and underscores, but not all numbers.
twttr.txt.regexen.hashSigns = /[##]/;
twttr.txt.regexen.hashtagAlpha = regexSupplant(/[a-z_#{latinAccentChars}#{nonLatinHashtagChars}]/i);
twttr.txt.regexen.hashtagAlphaNumeric = regexSupplant(/[a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}]/i);
twttr.txt.regexen.hashtagAlphaNumeric = regexSupplant(/[a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}#{special_chars_included}]/i);
twttr.txt.regexen.endHashtagMatch = regexSupplant(/^(?:#{hashSigns}|:\/\/)/);
twttr.txt.regexen.hashtagBoundary = regexSupplant(/(?:^|$|[^&a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}])/);
twttr.txt.regexen.validHashtag = regexSupplant(/(#{hashtagBoundary})(#{hashSigns})(#{hashtagAlphaNumeric}*#{hashtagAlpha}#{hashtagAlphaNumeric}*)/gi);
Expand Down