PHP 用于在字符串中重复的 RegEx 模式

PHP RegEx pattern for repeating within the string

我正在尝试为这个字符串制作正则表达式:

This is some string <select> this is another string <select var1> another string which can contain special characters <select var2> another variable string <select var1,var2>

我需要 select 所有不在 select 标签中的字符串。

Select all string not within <select> tag

有人可以帮忙吗?使用 PHP preg_match

通过使用 preg_split:

$str = 'This is some string <select> this is another string <select var1> another string which can contain special characters <select var2> another variable string <select var1,var2>';

$arr = preg_split('/\<.*?\>/',$str);
print_r($arr);