鍍金池/ 問答/數(shù)據(jù)分析&挖掘  Java/ 請教 正則能否匹配到特定字符串間所有包含特定字符的內(nèi)容

請教 正則能否匹配到特定字符串間所有包含特定字符的內(nèi)容

目標(biāo)字符串如下

/start
type 1
/end

/start
type 2
/end

/start
type 0
/end

/start
type 2
/end

/start
type 0
/end

請問能否用正則匹配的方式將所有包含type 0的/start /end段全匹配到

回答
編輯回答
浪婳

當(dāng)然可以。 /\/start[^\/]+type\s*0[^\/]+\/end/g

2017年6月15日 10:40
編輯回答
兔寶寶
\/start[\s\S]?type 0[\s\S]?\/end
2017年10月4日 13:03