如何从perl中的字符串中删除键盘表情符号?

时间:2017-01-12 09:56:51

标签: perlscript

我遇到从字符串中删除键盘表情符号的问题。键盘表情符号显示在URL中因此我使用此正则表达式删除表情符号,但此正则表达式也从字符串中删除中文字符。我希望正则表达式只删除键盘表情符号而不是任何字符。键盘表情符号图标属于utf8mb4字符集。

$ str = ~s / [\ x00- \ x1F \ x80- \ xFF] + \ s * // g;

$ str = ~s / \ xEE [\ x80- \ xBF] [\ x80- \ xBF] | \ xEF [\ x81- \ x83] [\ x80- \ xBF] + \ s * // g;

$ str = ~s /([0-9#] [\ x {20E3}])| [\ x {00ae} \ x {x}} \ x {2047} \ x {2048 } \ X {2049} \ X {3030} \ X {303D} \ X {2139} \ X {2122} \ X {3297} \ X {3299}] [\ X {FE00} - \ X {FEFF}] ?| [\ X {2190} - \ X {21FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2300} - \ X {23FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2460} - \ X {24FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {25A0} - \ X {25FF}] [ \ X {FE00} - \ X {FEFF}] | [\ X {2600} - \ X {27BF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2900} - \ X {297F}] [\ X {FE00} - \ X {FEFF}] |?[\ X {2B00} - \ X {2BF0}] [\ X {FE00} - \ X {FEFF}] | [\ X {1F000} - \ X {1F6FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {D83E}] [\ X {DD13} - \ X {DD14}] + \ S * //克;

$ str = ~s /([0-9 |#] [\ x {20E3}])| [\ x {xae} \ x {x}} \ x {\} {x} 2048} \ X {2049} \ X {3030} \ X {303D} \ X {2139} \ X {2122} \ X {3297} \ X {3299}] [\ X {FE00} - \ X {FEFF} ?] | [\ X {2190} - \ X {21FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2300} - \ X {23FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2460} - \ X {24FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {25A0} - \ X {25FF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2600} - \ X {27BF}] [\ X {FE00} - \ X {FEFF}] | [\ X {2900} - \ X {297F}] [\ X {FE00} - \ X {FEFF}] |?[\ X {2B00} - \ X {2BF0}] [\ X {FE00} - \ X {FEFF}] | [ \ X {1F000} - \ X {1F6FF}] [\ X {FE00} - \ X {FEFF}] + \ S * //克?;

0 个答案:

没有答案