Skip to content

Commit

Permalink
#0 is not a valid hashtag
Browse files Browse the repository at this point in the history
  • Loading branch information
KengoTODA committed Jul 14, 2011
1 parent a595e04 commit 5bf0191
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/twitter/Regex.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Regex {

private static String LATIN_ACCENTS_CHARS = "\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff";
private static final String HASHTAG_ALPHA_CHARS = "a-z" + LATIN_ACCENTS_CHARS +
"\\u0400-\\u04ff0\\u0500-\\u0527" + // Cyrillic
"\\u0400-\\u04ff\\u0500-\\u0527" + // Cyrillic
"\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF" + // Hangul (Korean)
"\\p{InHiragana}\\p{InKatakana}" + // Japanese Hiragana and Katakana
"\\p{InCJKUnifiedIdeographs}\\u3005" + // Japanese Kanji / Chinese Han
Expand Down
3 changes: 3 additions & 0 deletions tests/com/twitter/RegexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public void testAutoLinkHashtags() {
assertTrue(Regex.AUTO_LINK_HASHTAGS.matcher("これはOK #ハッシュタグ").find());
assertTrue(Regex.AUTO_LINK_HASHTAGS.matcher("これもOK。#ハッシュタグ").find());
assertFalse(Regex.AUTO_LINK_HASHTAGS.matcher("これはダメ#ハッシュタグ").find());

assertFalse(Regex.AUTO_LINK_HASHTAGS.matcher("#123").find());
assertFalse(Regex.AUTO_LINK_HASHTAGS.matcher("#012").find());
}

public void testAutoLinkUsernamesOrLists() {
Expand Down

0 comments on commit 5bf0191

Please sign in to comment.