By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,691 Members | 2,041 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,691 IT Pros & Developers. It's quick & easy.

regexp question :

P: 51
Hi,



i'd like to know how to make a regexp that catches the following patterns
ABC[A-Z][A-Z][A-Z] but not ABCDEF and ABCDEE

i've tried somthing like, but the interpreter regards the characters inside the brakets as seperately and not as a combination:

/ABC[^DEF|DEE]/


thanks,
May 22 '08 #1
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
Expand|Select|Wrap|Line Numbers
  1. $str = 'ABCDEE';
  2. if ($str =~ /^ABC(?!DEF|DEE)[A-Z][A-Z][A-Z]$/) {
  3.     print "match";
  4. }    
May 22 '08 #2

P: 51
thanks alot, that was really helpful. i've managed to get the concept and used it in different patterns.

originally i wanted to use regexp in unix (c-shell), so i want to know whether there a short way to activate instant perl code lines to parse files.

for example, catch all line that contains certain regexp in a file.



thanks again,
May 27 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
thanks alot, that was really helpful. i've managed to get the concept and used it in different patterns.

originally i wanted to use regexp in unix (c-shell), so i want to know whether there a short way to activate instant perl code lines to parse files.

for example, catch all line that contains certain regexp in a file.



thanks again,
I don't know.
May 27 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.