in reply to Re: Regular expreesion for extraction of words
in thread Regular expreesion for extraction of words

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: regular expression by funky monk
by FunkyMonk (Bishop) on Aug 29, 2007 at 12:40 UTC
    Ah, I hadn't realised you wanted that:( You won't get two arrays back from one match. I'd get everything in to a single array by replacing NOT with (?:NOT|AND|OR), and then use grep to split it up how I wanted.

    Here's some tips on how to format your posts correctly.

    Update

    You should tell us exactly what output you want from the string you gave.

Re^2: regular expression by funky monk
by Archana (Initiate) on Aug 31, 2007 at 03:42 UTC
    hi,

    I want in separate arrays.

    o/p:-(1st array)
    (control OR regulat) (blood AND marrow)
    (2nd array)
    (transcription AND factor) (TATA OR TBP)
    $_ = '((transcription AND factor)NOT(control OR regulat) AND (TATA OR +TBP) NOT (BLOOD AND marrow))'; my @caps = m/NOT # "NOT" \s* # spaces? ( # start capturing \( # "(" [^)]+ # some not ")"s \) # ")" ) # end capture /xg; print join "\n", @caps;