[1505] fix emoji regexp to exclude non-emoji chars
This commit is contained in:
@@ -34,7 +34,7 @@ extension StringExtension on String {
|
||||
if (trimmedString.isEmpty) return false;
|
||||
if (trimmedString.characters.length > 3) return false;
|
||||
final emojiRegex = RegExp(
|
||||
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+$',
|
||||
r'^(\u00a9|\u00ae|\u200d|[\ufe00-\ufe0f]|[\u2600-\u27FF]|[\u2300-\u2bFF]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])+$',
|
||||
multiLine: true,
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
@@ -81,6 +82,16 @@ void main() {
|
||||
expect('🌶1'.isOnlyEmoji, false);
|
||||
expect('👨👨👨👨'.isOnlyEmoji, true);
|
||||
expect('👨👨👨👨 '.isOnlyEmoji, true);
|
||||
expect('👨👨👨👨'.isOnlyEmoji, false);
|
||||
expect('⭐⭐⭐'.isOnlyEmoji, true);
|
||||
expect('⭕⭕⭐'.isOnlyEmoji, true);
|
||||
expect('✅'.isOnlyEmoji, true);
|
||||
expect('☺️'.isOnlyEmoji, true);
|
||||
});
|
||||
|
||||
test('korean symbols', () {
|
||||
expect('ㅎㅎㅎ'.isOnlyEmoji, false);
|
||||
expect('ㅎㅎㅎㅎ'.isOnlyEmoji, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user