|
|
| Perl: the Markov chain saw | |
| PerlMonks |
Re: exact word matchby samarzone (Pilgrim) |
| on Dec 22, 2010 at 12:23 UTC ( #878496=note: print w/ replies, xml ) | Need Help?? |
|
Square brackets are for matching individual characters. The regex you wrote will reject (because of ^) any word that has any of 'm', 'a', 's', 't', 'e', 'r', '|' .. and so on. If you meant a valid database name except the names given in your regex you could have written
Update: This can also be written in a single regex using negative look-ahead assertion as follows
--
Regards
- Samar
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||