开发者

Required to solve this regex issue

I need to get all characters between a particular expression. For example below is my sample document This is a sample document.

$condtion FIRST This text can be repeated many times until do while is called.

$endcondition

I need to get all the characters between $condtion and $endcondition But the while(matcher.find()) loop is getting called three times. Is it possible to hand开发者_StackOverflow社区le this in regular expression. Only one condition must be satisfied. If that condition is satisfied the other conditions need not be called.


Your expression matches either \\#if\\s*\\((.*?)\\)(.*?)\\#elseif or #else or #endif. If you only want an or around the closing statement of the if block then you have to put it into a group like (?:elseif|else|endif).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜