jermainedilao
07/25/2018, 7:09 AM"hello world".matches(Regex("([A-Za-z])"))
Lucas Ł
07/25/2018, 7:10 AMrobin
07/25/2018, 7:13 AMmatches
tries to match the entire input, even if that's not really stated in the Kdoc. This returns true: "hello world".matches(Regex("(.*[A-Za-z].*)"))
Lucas Ł
07/25/2018, 7:15 AMReturns true if this char sequence matches the given regular expression.
I see how the choice of words might be confusing to some...
For the match you can use even simpler "[A-z\s]*"
jermainedilao
07/25/2018, 7:24 AMgildor
07/25/2018, 7:28 AMjermainedilao
07/25/2018, 7:29 AMAllan Wang
07/25/2018, 6:53 PMcontains
to just check if the regex matches any segment for the string. And if you are checking for letters only, you can do Regex([A-Za-z]*)
(which wouldn’t match hello world due to the space)