Regex matching emoticons

后端 未结 4 1876
春和景丽
春和景丽 2020-12-10 07:06

We are working on a project where we want users to be able to use both emoji syntax (like :smile:, :heart:, :confused:,:stuck_ou

4条回答
  •  醉话见心
    2020-12-10 07:28

    I assume these emoticons will commonly be used with spaces before and after. Then \s might be what you're looking for, as it represents a white space.

    Then your regex would become

    \s+(\:\)|\:\(|<3|\:\/|\:-\/|\:\||\:p)\s
    

提交回复
热议问题