Reg Exp Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PerlE

    Reg Exp Help

    Hi,
    I have data in a file in two column formats, which I am trying to search and
    match for certain expressions.
    Data is as such:
    foo1 foo1[ ]
    foo2 foo2( )
    bar1 bar1( ) ( )
    bar2 [ ][ ]
    …I want to be able to search for the followings by reading this file:
    Please note that the issue is "[ ]" and "( )" and not the words in front of
    them.
    ignore[m][n]
    ignore1(m) [n]
    ignore2[m] (n)
    ignore3(m) (n)
    ignore4[m] ß--------Done, refer below
    ignore5(m)[x:y]
    ignore6[m][x:y]
    ignore7[m](x:y)
    ignore8(m)(x:y)
    # I have done pattern match for foo1 foo1[ ]; as shown below
    if (
    /^\s*([\w|\/|\#]+)\s+([\w|\/|\#]+)\s*\[([^\]]+)\]\s*;/ ){
    print “ Found [ ] categories”;}
    I need similar one-liners for other combination above. it keeps complaining
    about using “(“ as delimiter !!!
    Thank You.
    B


Working...