2017-05-12 23 views
-5

我試圖讓正則表達式這個字符串中重複PHP正則表達式:的字符串

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 all string not within <select> tag 

任何人都可以幫忙嗎?使用PHP的preg_match

+2

你應該知道如何[問一個很好的問題(https://stackoverflow.com/help/how-to-ask) – Mohammad

+0

你嘗試過什麼?你得到什麼錯誤? – calexandre

+0

@Mohammad:是的,我在搜索3小時後發佈了這個問題。 – Riyo

回答

0

使用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);