in reply to Combining Regex
Okay you changed the question a few times while I was composing this reply ;o). Have to say i'm still left guessing what the ordering rules are for the angle bracket segments. I picked one ordering that gives the results you're requesting, but you may still have to tweak them a bit. The main idea is to ignore whitespace in the regex using the /x parameter so that you can format the regex for readability:
use strict; use warnings; while (<DATA>) { print if / <MIR-\d+> ( <EXP-V-\d+> (<ART-\d+>)* (<BE-V>)* | <ASSC-PHRASE-\d+> ) <VACCVIRUS-PROP-\d+>/x; } __DATA__ <MIR-1><EXP-V-3><VACCVIRUS-PROP-1> <MIR-1><ASSC-PHRASE-1><VACCVIRUS-PROP-1><PATTERN-1> <MIR-1><EXP-V-0><ART-0><VACCVIRUS-PROP-1> <MIR-1><EXP-V-0><ART-0><BE-V><VACCVIRUS-PROP-1> <MIR-1><EXP-V-0><EXP-N-0><VACCVIRUS-PROP-1>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Combining Regex
by neversaint (Deacon) on Jul 23, 2013 at 09:39 UTC |