我有一個字符串模板,我需要從中獲取#elseif塊的列表。正則表達式 - 需要幫助
但它只返回一個匹配,即第一個#elseif塊,而不是第二個。我還需要獲得第二個#elseif塊。你能幫我做到嗎?請找到下面的字符串模板。
String template =
"This is a sample document."
+ "#abc (#processing)"
+ "FIRST This text can be repeated many times until do while is called."
+ "#abcif (v2)"
+ "Some sample text after 1st ElseIf."
+ "#abcif(v2)"
+ ";
可能重複[正則表達式需要幫助。(http://stackoverflow.com/questions/3823362/regex-help-needed) – NullUserException 2010-09-30 04:01:21
以前的職位是隻返回一個匹配。我需要得到所有elseif塊 – Apps 2010-09-30 04:05:27
我認真的不認爲正則表達式是正確的解析工具。創建一個語法並使用ANTLR。 – 2010-09-30 04:44:16