这是我关于Stack Overflow的第一个问题,我很乐意提供帮助。
我使用正则表达式从用户输入的文本中检测表情符号。我用来匹配表情符号的正则表达式是:
(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])
但是,仅在移动设备上,它还会匹配各种非表情符号,包括'
和"
我已经尝试过其他正则表达式来进行表情符号匹配,但是没有一个比这个更简洁或也可以工作。
有人可以帮我吗?
要实时查看问题,请将文本/表情符号/符号插入“个人消息”字段(使用移动设备):https://2050.cards/shop/birthday/eskimo-surprise/
示例输入:
不应且不匹配:
Dear you, Happy Birthday.
应该匹配并且匹配:
Dear you ?, Thanks. ?
不能匹配(仅在移动设备上):
Dear you, let's all "hang out"
答案 0 :(得分:3)
正确的方法是使用Unicode property escapes。
$queryIniciar=Conexion::conectar()
->prepare("SELECT *
FROM `usuarios`
WHERE `IDENTIFICACION`=:nit
AND `CLAVE`=:clave");
$queryIniciar->bindParam(':nit',$datos['nit'], PDO::PARAM_STR);
$queryIniciar->bindParam(':clave',$datos['clave'], PDO::PARAM_STR);
$queryIniciar->execute();
$resultados=$queryIniciar->fetchAll(PDO::FETCH_ASSOC);
$_SESSION['identificacion']=$resultados;
if($_SESSION['identificacion']['ID_USUARIO_FK']==1){
header("location: ../administrador.php");
exit;
}else if($_SESSION['identificacion']['ID_TIPO_USUARIO_FK']==2){
header("location: ../cliente.php");
exit;
}
echo $queryIniciar->rowCount();