試試這個
(?<=Func\()(?<match>(?:[^\r\n]+_\r\n)+[^\r\n]+)
說明
@"
(?<= # Assert that the regex below can be matched, with the match ending at this position (positive lookbehind)
Func # Match the characters 「Func」 literally
\( # Match the character 「(」 literally
)
(?<match> # Match the regular expression below and capture its match into backreference with name 「match」
(?: # Match the regular expression below
[^\r\n] # Match a single character NOT present in the list below
# A carriage return character
# A line feed character
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
_ # Match the character 「_」 literally
\r # Match a carriage return character
\n # Match a line feed character
)+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
[^\r\n] # Match a single character NOT present in the list below
# A carriage return character
# A line feed character
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
)
"
這是否說明來正確關閉正則表達式的好友? – 2012-07-19 05:39:10
@FabrícioMatté:是的。 – Cylian 2012-07-19 05:40:23
正在測試它,很好地完成。 +1 – 2012-07-19 05:45:25