Regex for First name only English
\S matches any non-whitespace character (equal to [^\r\n\t\f\v ] ). I am no regex ninja, but this should work: ^[A-Za-z][A-Za-z ]{0,7} . See: https://regex101.com/r/xQe81c/4
Technical answers from my Stack Overflow history, with source links and licenses.
Showing 6 of 6 answers tagged regex
Exported May 9, 2026
\S matches any non-whitespace character (equal to [^\r\n\t\f\v ] ). I am no regex ninja, but this should work: ^[A-Za-z][A-Za-z ]{0,7} . See: https://regex101.com/r/xQe81c/4
You can use ^[^ ]+ . Example: See: https://regex101.com/r/aZYgvC/1
This works with all the examples from your logcat messages: https://regex101.com/r/P7lICp/1 Personally, I would rethink what you are doing.
A valid Android package name is described in the AndroidManifest documentation for the package attribute: The name should be unique. The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and...
It looks like an easy solution if this is the only String you are attempting to split. Something like this would work for the input String you provided in your question: You can use http://regexpal.com/ to help you in...