We don't bite newbies here... much | |
PerlMonks |
Re: regex for stringby markkawika (Monk) |
on Aug 18, 2009 at 18:09 UTC ( [id://789544]=note: print w/replies, xml ) | Need Help?? |
It's tough to do this for edge cases in one regex, so I would solve it in two. First, grab the first character:
Then, grab the last character:
If you could guarantee the string was at least two characters long, you could do it in one regex:
If you insist on handling all edge cases in one regex, here's one way:
In Section
Seekers of Perl Wisdom
|
|