开发者

Required to solve this regex issue

开发者 https://www.devze.com 2023-01-18 04:56 出处:网络
I need to get all characters between a particular expression. For example below is my sample document

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

精彩评论

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