regex - Java Pattern / Matcher not finding word break -
I'm having trouble with Java patterns and matures, what I'm trying to do is a very simple one. Example I've included.
Let me first use the word (or "to find the last character of" 4 "for example), but as I move through the code, m.find () always gives false. What am I missing here?
Why do the following Java code always print "Not found"?
Patterns p = pattern.compile (". \ B" ); Matter M = P. Mettor ("102939384 is a word"); Int ixEndWord = 0; if (m.find ()) {ixEndWord = m.end (); System.out.println ("found:" + IxEndWord;} Else {System.out.println ("not found");} << code>
< P > You need to avoid special characters in regex: ". In fact, the backslash has to be run in the string, so the code becomes "\\" '\' . then the string ". \ B " becomes little string ". \ B ", which will be used by the pattern.
Comments
Post a Comment