“我正在尝试运行一个测试,以查看具有多行的长字符串是否具有相同模式的多个出现,或者说5或10个出现。因此,像这样的字符串:”
所以在这种情况下,我正在尝试使用PHP:
当然这不起作用。
我不能使用 preg_match_all。
请问有人能更正我的正则表达式吗?
$string = "this is a test pattern1 more of a test pattern1
and so on and so on pattern1";
所以在这种情况下,我正在尝试使用PHP:
if (preg_match('/(pattern1)\1{2,}/m',$string)) print "Found 2+ occurrences of pattern1\n";
当然这不起作用。
我不能使用 preg_match_all。
请问有人能更正我的正则表达式吗?