I am trying to make sure that if someone's name starts with just one character (between "space" and "tilde") OR it starts with one letter followed by a "dot" it's no good BUT if it is one letter followed by a dot and another character it's OK.
Meaning these names are ok, J.D. or TJ.
But these are BAD J or T.
Here's what I have:
Expand|Select|Wrap|Line Numbers
- my $name = "J.D. McKinney";
- if ($name =~ m{ \A (?: [\x20-\x7E]{1}\.?\b\W ) }xms){
- print "matched";
- }
- else{
- print "no match";
- }
It prints "matched".
How can "the beginning of the line followed by any character from space to tilde once, followed by 1 or 0 dots followed by a word boundary followed by a NON WORD character" match THAT string!!???
I can't see what is wrong..
Any help would be MUCH appreciated!!