At 23:50 -0700 10/05/2012, jmichel wrote:
>Thanks for these explanations. They confirm what I suspected.
>Assuming that the number of lines in one group can never exceed, say, 15
>or so, could one circumvent the difficulty by explicitly repeating the
>search pattern a sufficient number of times?

Yes, and please see below.


>Then the problem would be to ensure a match also in the case when the
>number of lines is smaller. Any idea on how that could be achieved? Could
>conditional matching help (I am not familiar with those "advanced
>features")?

To do this, just modify your existing pattern to find successive pairs of
matching lines and combine their contents:

Find:       (\d{6})(.+)(?:\r\1(.+))

Replace:    \1\2\3

and then repeatedly apply Replace All until all line pairs which start with
the same numeric prefix have been consolidated to single lines.

(E.g. for groups of 16 lines or fewer, this will take at most 4 passes of
Replace All; for groups of 64 lines or fewer, 6 passes; etc.)


PS: John Delacour's text filter is a much nicer general solution; the only
advantage of the above is it doesn't require knowledge of Perl.


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.             <http://www.barebones.com/>

-- 
-- 
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>



Reply via email to