mercredi 11 février 2015

String pattern that prevents the first character being a whitespace

I'm having a bit of difficulty figuring out a pattern that will allow anything to be entered, as long as the first character isn't a whitespace. I've tried



String pattern = "[^\\s][a-zA-Z0-9\\W ]+";"


and "([a-zA-Z0-9\\W]+)|(([a-zA-Z0-9\\W]+\\s[a-zA-Z0-9\\W]+)+)" as well as several other variants, with no success. Any help would be greatly appreciated.


I'm using Java btw


Aucun commentaire:

Enregistrer un commentaire