Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.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
Php 正则表达式中的大于和小于符号_Php_Regex - Fatal编程技术网

Php 正则表达式中的大于和小于符号

Php 正则表达式中的大于和小于符号,php,regex,Php,Regex,我对正则表达式还不熟悉,我只是厌倦了真正学习所有的正则表达式字符等等。我需要知道正则表达式中大于符号的目的是什么,例如: preg_match('/(?<=<).*?(?=>)/', 'sadfas<email@email.com>', $email); preg_match('/(?大于号符号仅与目标字符串末尾的文本匹配 小于符号并不是那么简单。首先让我们回顾一下lookaround语法: 模式(?您的正则表达式使用lookarounds捕获字符之间的电子邮件地

我对正则表达式还不熟悉,我只是厌倦了真正学习所有的正则表达式字符等等。我需要知道正则表达式中大于符号的目的是什么,例如:

preg_match('/(?<=<).*?(?=>)/', 'sadfas<email@email.com>', $email);

preg_match('/(?大于号符号仅与目标字符串末尾的文本
匹配

小于符号并不是那么简单。首先让我们回顾一下lookaround语法:


模式
(?您的正则表达式使用lookarounds捕获
字符之间的电子邮件地址。在您的示例输入中,它捕获
email@email.com

说明:

(?<=<) Positive Lookbehind - Assert that the regex below can be matched
< matches the character < literally
.*? matches any character (except newline)
Quantifier: Between zero and unlimited times, as few times as possible,
expanding as needed [lazy]
(?=>) Positive Lookahead - Assert that the regex below can be matched
> matches the character > literally
(?逐字匹配字符>)

在线演示:这是一个与目标字符串中最后一个
匹配的文本。链接到:我不懂你能描述一下我不懂吗(?希望现在你已经理解了这些答案:)不,我不懂(?=就像我在回答中写的那样。
(?这是一个令人印象深刻的网站