C
C
Chvalov2019-03-17 05:55:39
Java
Chvalov, 2019-03-17 05:55:39

How to find part of a word using a regular expression?

It is necessary to find a word or part of a word in the content using regex
There is a line: With this approach:String INPUT = "social network facebook";

Boolean result = INPUT.matches("\\w*face\\w*"); // false
the result will be false because it looks for the whole word (matches) .
Is it possible to compose a regular expression in such a way that (matches) looks for part of the word ?
We need an implementation without using the connection between the Pattern and Matcher classes in which there is matcher.find()(which works with this regular expression as I need it) if possible ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-03-17
@Chvalov

.*word.*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question