Regex preg“u match”u all find string not“;http「;之后#
我需要找到一个字符串,该字符串不包含Regex preg“u match”u all find string not“;http「;之后#,regex,preg-match-all,Regex,Preg Match All,我需要找到一个字符串,该字符串不包含https或http,而是在# 演示: 我的代码是在#之后查找内容 preg_match_all(“/#([^\s]+)/”,$content,$matches) 这应该适合你 ^(http://)(?#) 我相信您首先要确保字符串是一个URL,然后再获取hashbang背后的所有内容?(包括hashbang)。那么我相信这个带有非捕获组的正则表达式会起作用: preg_match_all('/^(?:https*:\/\/.*)(#.*)$/', $url
https
或http
,而是在#
演示: 我的代码是在#之后查找内容
preg_match_all(“/#([^\s]+)/”,$content,$matches) 这应该适合你
^(http://)(?#)
我相信您首先要确保字符串是一个URL,然后再获取hashbang背后的所有内容?(包括hashbang)。那么我相信这个带有非捕获组的正则表达式会起作用:
preg_match_all('/^(?:https*:\/\/.*)(#.*)$/', $url, $matches);
我怀疑您正在使用php:)
您可以在这里查看:请更精确地描述您的实际输入和输出字符串。你的目标可以通过各种方式实现。
preg_match_all('/^(?:https*:\/\/.*)(#.*)$/', $url, $matches);
^(?!https?://).*?$