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
Post a Comment