How to match a URL containing emojis using a regex?

后端 未结 3 886
无人及你
无人及你 2021-01-07 13:10

How can I write a regular expression to match URLs that contain emojis? The regex should match ordinary alphanumeric URLs along with URLs containing emojis in the domain nam

3条回答
  •  执念已碎
    2021-01-07 14:01

    http://\S+

    Where \S+ captures all non whitespace

    The trick is keeping the regex from being too greedy, you may need some additional info to help determine the end of the url, is it whitespace or encapsulated in some way?

提交回复
热议问题