Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 当字符位于两个字符之间时匹配的正则表达式,但内部字符可以是外部分隔符之一_Regex_Url_Regex Lookarounds_Regex Group_Iri - Fatal编程技术网

Regex 当字符位于两个字符之间时匹配的正则表达式,但内部字符可以是外部分隔符之一

Regex 当字符位于两个字符之间时匹配的正则表达式,但内部字符可以是外部分隔符之一,regex,url,regex-lookarounds,regex-group,iri,Regex,Url,Regex Lookarounds,Regex Group,Iri,我有这样一个字符串: <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.com/code/INSTRUMENTS/AGD<1> <https://example.com/code/INSTRUMENTS/AGD>1> 我想要一个正则表达式,在任何情况下都能匹配: <http://www.w3.org/1999/02/22-rdf-syntax-ns#t

我有这样一个字符串:

<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<https://example.com/code/INSTRUMENTS/AGD<1>
<https://example.com/code/INSTRUMENTS/AGD>1>

我想要一个正则表达式,在任何情况下都能匹配:

<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<https://example.com/code/INSTRUMENTS/AGD<1>
<https://example.com/code/INSTRUMENTS/AGD>1>

检测此类无效序列化的IRI(类似于URI/URL)


我已经看过了,但是当内部字符与外部字符相同时,它们似乎都不起作用。

假设
,并且它们不能“嵌套”:

(]*[^)

如果只是布尔检查/验证,这将检测它们

如果您还想捕获完整字符串

(]*[^)


(我希望我没有输入错误)

我们需要在更大的文本中查看这些标记的上下文,但无论如何,您可能需要一个平衡的解析器来处理这一问题。