At 12:57 -0500 11/30/11, Ronald J Kimball wrote:
>On Wed, Nov 30, 2011 at 09:46:51AM -0800, David wrote:
>> Ronald,
>>
>> Thanks. What would be the best way to edit your regex so I can simply
>> paste it into the BBEdit find dialog box?
>
>I am not in front of a Mac at present, but I believe it should work in
>BBEdit as is.
>
>Ronald
>
At 12:21 -0500 11/30/11, Ronald J Kimball wrote:
>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
>)
>
Ronald surely means that you should concatenate the first parts of each line
into the search string which is using grep. Remove \s*?#.*\r from the message
as opened in BBEdit.
But on a file opened by BBEdit you'll want to use \r instead of \n to match the
line ends. That's because BBEdit will be using 16 bit characters after
converting whatever line ends were on the original to 0D, the old Macintosh way.
Reading the original text in, say, a perl script you would have to match the
original line ends whatever they were. I'd bet they came from a peecee and are
originally 0A0D pairs.
I also don't think it's necessary to escape the spaces.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
--
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>