Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regex pattern - unprintable characters

 
Pavan Kumar
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,
I'm unable to figure out a pattern in regex for the following problem, I'd very much appreciate your inputs in this regard,

I must validate a String, the validation rules are.
The String must not start with an underscore(-), a space or an unprintable character.
The string must not contain any empty spaces or unprintable characters.

Except for unprintable characters my pattern looks OK, here's what I have

Could you please suggest me how to enhance my pattern in order to check for any unprintable characters in the string.

Thanks,
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out in the Pattern API :

POSIX character classes (US-ASCII only)
...
\p{Print} A printable character: [\p{Graph}]
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic