in reply to Regular expreesion for extraction of words

How about:

$_ = '((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;

Output:

(control OR regulat) (BLOOD AND marrow)

See perlretut for a tutorial and perlre for the details on regular expressions.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.