in reply to Match only certain characters?
#!/usr/local/bin/perl use strict; use warnings; #f = first, s = second. my $f='ABCAAAABBBCCCCCAAABBBCCC'; my $s='ASRGRTGRT89579843rrrrrr'; print $f=~/(?=^[ABC]+$)/? "Matches [ABC] Combinations\n": "No pattern +found!\n"; print $s=~/(?=^[ABC]+$)/? "Matches [ABC] Combinations\n": "No pattern +found!\n";
Update: added a link that might benefit the OP.#OUTPUT: Matches [ABC] Combinations No pattern found
|
|---|