CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [pdolinski] RegEx with 'and': Edit Log

Veteran / Moderator

Aug 20, 2015, 7:48 AM

Views: 2143
Re: [pdolinski] RegEx with 'and'

You could achieve your goal with a single complex regex, but in this case, I'd use 2 simple regex's.

my @name = ('mydb_cli_6', 'yourdb__dli_7'); 

foreach (@name) {
if ( /^[a-z]+\w+$/i and not /_{2,}/) {
print "$_ is ok\n";
else {
print "$_ is BAD\n";

/_{2,}/ could also be written as /__/

(This post was edited by FishMonger on Aug 20, 2015, 7:51 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Aug 20, 2015, 7:51 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives