On Wed, Nov 30, 2011 at 07:38:00AM -0800, David wrote:
> THIS IS TRIP NUMBER 16
> THIS TRIP OPERATES ON DAY(S): 3
> CREW POSITIONS ARE: 1 CREW
>
> 0300 PHX 07:40 CLT 13:34 03:54 23:23 3 01 00 00 01 00 00 1
> ---------------------------------------- (03:54,05:09)
> 0303 CLT 12:57 PHX 15:39 04:42 1:01 * 4 01 00 00 01 00 00 1
> 0303 PHX 16:40 LAS 16:50 01:10 0:57 * 4 01 00 00 01 00 00 1
> 0603 LAS 17:47 PHX 20:00 01:13 (037:35) 4 01 00 00 01 00 00 1
> (07:05,10:03)
> THE CALCULATED CREW COST IS 10:59
> I need help writing a regex that will let me search for trips that
> have XX number of legs on the last day. I expect that I would need to
> edit the XX number in the regex string, depending on whether I want to
> search for trips with 3 or 4 or 5, etc legs on the last day.
I believe this regex will do what you want. It matches a trip with exactly
three flights on the last day, including trips of a single day.
(?mx)
(^THIS\ IS\ TRIP\ NUMBER.*\n # initial header
(?:\S.*\n)* # any additional headers
\n # blank line
(?:
(?:[ \t]*\d.*\n)+ # one or more flights
[ \t]*-----+.*\n # day separator
)*
(?:[ \t]*\d.*\n){3} # exactly three flights
[ \t]*\(.*\n # total time
THE\ CALCULATED\ CREW\ COST.*\n # final line
)
You can change {3} e.g. to {4} to match exactly four flights on the last
day, to {3,5} to match from three to five flights, or to {3,} to match
three or more flights.
Ronald
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>