regex - How to convert this regular expression into a format java can use? -


i want use regular expressions able parse sequence this...

ifelseifelseififif 

where every else needs if not every if needs else. plan on using expression

((if)*+(ifelse)*)* 

but don't know how convert format can use in java. show me , break down me?

in regex logic want match:

(if if
| or
ifelse) ifelse
* token, 0 or more times.

(if|ifelse)*

this match 0 or more if/elseifs.

if need fill entire string start end, e.g. no partial matches, put ^ before , $ after it:

^(if|ifelse)*$

please read http://www.regular-expressions.info/reference.html introduction regex syntax (for instance, + not think in regexes), , use http://www.regexpal.com test regexes in browser.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -