There is a line in which you need to find letters from which you can make a certain word, i.e. each letter should appear at least once.
For example: String s=" oasd c ";
Regular expression to her `
Pattern pattern = Pattern.compile("c+ & o+"); Matcher matcher = pattern.matcher(toReturn); return matcher.find();`
It does not work, it should produce true, but it gives false How to write an expression that checks the line where each letter is indicated to meet one or several times. I tried differently, I was dug for an hour.
cccccccccccccccc & ooooo
, but not the same as in your example. Do you want to find the lettersc
ando
in the example regularly? Ampersand is not a special character in regular expression. You probably want something like.*c.*|.*o.*
O..*c.*|.*o.*
- iksuy(.*o.*c.*)|(.*c.*o.*)
O.(.*o.*c.*)|(.*c.*o.*)
O.(.*o.*c.*)|(.*c.*o.*)
- Vartlok