I need to remove all unicode emojis from a QString, so I tried to write a regex:
QRegularExpression uTF8Emojis("([\\xD83D][\\xDE00-\\xDFFF])+");
but that does not detect anything...
I need to remove all unicode emojis from a QString, so I tried to write a regex:
QRegularExpression uTF8Emojis("([\\xD83D][\\xDE00-\\xDFFF])+");
but that does not detect anything...
Since Qt5 QRegularExpression
is PCRE-powered, you may use the whole code points for the characters inside \x{...}
notation, no need to define these emojis as a sequence of bytes:
"[\\x{1F600}-\\x{1F7FF}]+"
You may use this online converter: paste \uD83D\uDE00-\uD83D\uDFFF
into the JavaScript field, and click Convert to get the right codes in the U+hex field.
I use this in my QRegularExpression https://github.com/mathiasbynens/rgi-emoji-regex-pattern/blob/main/dist/emoji-14.0/java.txt And it works just fine And author update regexp regularly with recent emojis