467,145 Members | 1,039 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

regexp question :

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
  • viewed: 820
Share:
3 Replies
KevinADC
Expert 2GB
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
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 2GB
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.

Similar topics

10 posts views Thread by Anand Pillai | last post: by
5 posts views Thread by Lukas Holcik | last post: by
reply views Thread by Chris Croughton | last post: by
8 posts views Thread by Dmitry Korolyov | last post: by
6 posts views Thread by runsun pan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.