這是我的原字符串: -用什麼分裂我的字符串'preg_split`
$data = "<br />
Q.156) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.157) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.158) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.159) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.160) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.161) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
<br />
Q.162) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow: <br />
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department <br />
";
我想我的字符串分割爲數組中此格式
Array (
[0] => Q.156) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[1] => Q.157) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[2] => Q.158) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[3] => Q.159) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[4] => Q.160) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[5] => Q.161) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
[6] => Q.162) Direction (156–160): Study the given pie-charts carefully to answer the questions that follow:
Breaking up :- Number of Employees working in Different Departments of an Organisation, the Number of Males and the Number of Employees Who Recently Got Promoted in Each Department
)
我知道我可以使用preg_split('/[Q[.]]+/', $data)
但是我在正則表達式方面有點弱。 請幫我我的正則表達式合併相應..
不,我必須保持中斷標記。 –
@ chris85偉大的工作....但我需要像'Q.1234)一樣的通用',因爲你看到之後有整數。 (「/ d」)..現在會是最終的正則表達式 –