regexp question :

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zcabeli
    New Member
    • Jan 2008
    • 51

    #1

    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,
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Code:
    $str = 'ABCDEE';
    if ($str =~ /^ABC(?!DEF|DEE)[A-Z][A-Z][A-Z]$/) {
        print "match";
    }

    Comment

    • zcabeli
      New Member
      • Jan 2008
      • 51

      #3
      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,

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Originally posted by zcabeli
        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.

        Comment

        Working...