这个问题在这里已有答案:
我正在尝试为此字符串制作正则表达式:
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 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);