regex - find specific string pattern in text using regular expression in java -
i need find regular expression use argument in string.matches
. have text of strings separated space " "
, want find type of number it. first of need check pattern this: "[number] e [number] & [number]"
. &
symbol in string, e
.
// *word* string tested if (word.matches("\d++ e *\d++ & \d++")) *something that*
for example "1001Ε101&2"
true , "0114&2"
false.
so need regular expression in word.matches(" *answer* ");
it's project in lexical analysis. must not use ready lexers.
your regex right. use way:
pattern.matches("\\d++ *e *\\d++ *& *\\d++", word);
with word
string check.
don't forget use double \
in regex string put simple \
.
Comments
Post a Comment