Copying a search pattern to a new document

35 views
Skip to first unread message

Mohannad Mahmoud

unread,
Feb 27, 2020, 8:33:45 AM2/27/20
to BBEdit Talk
Hello to all,

I am trying to copy a search pattern to a new document. I am not sure this can be done in Canonize or Processing Lines Containing 

The file I am doing a search in has the following;

3/004
03:00:19:18 0041+10
03:00:23:10 0047+02
03:16 5+08
Mrs Nora? Forgive me.
(Intenral)
Thomas: Well...
ENTERS DOOR
DIANA (OS): Forgive
5 03:00:21:14 0044+06
CUT TO MS - PM DIANA L
DIANA: my interruption. Sir Eric Gairy, the Prime Minister of Grenada.

I need to only copy the first 5 lines;
3/004
03:00:19:18 0041+10
03:00:23:10 0047+02
03:16 5+08
Mrs Nora? Forgive me.

The search patter I am using is;
(3/[0-9]*\r[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}\s[0-9]{4}\+[0-9]{2}\r[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}\s[0-9]{4}\+[0-9]{2}\r[0-9]{2}:[0-9][0-9]\s[0-9]\+[0-9]{2}\r^.*$)

Which is working fine in the classic search and replace function but not in canonize and process line containing

I do not have a coding background, I would appreciate your help guys 
Many thanks

Greg Raven

unread,
Feb 27, 2020, 10:45:40 AM2/27/20
to BBEdit Talk
Does this work for you?

\A.*?\n.*?\n.*?\n.*?\n.*?\n

Mohannad Mahmoud

unread,
Feb 27, 2020, 11:10:49 AM2/27/20
to BBEdit Talk
Will check it, hope it works

Thanks a lot

Kaveh Bazargan

unread,
Feb 27, 2020, 11:15:15 AM2/27/20
to bbe...@googlegroups.com
Mohannad

A very useful site for testing regex is regex101. And you can save and copy a test page and it will be there for ever! I put Greg's suggestion here:


--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/a8c81bd1-a765-4269-b2ff-9af2826f57af%40googlegroups.com.


--
Kaveh Bazargan PhD

Rich Siegel

unread,
Feb 27, 2020, 11:15:45 AM2/27/20
to bbe...@googlegroups.com
On 2/27/20 at 11:14 AM, ka...@rivervalleytechnologies.com (Kaveh
Bazargan) wrote:

>A very useful site for testing regex is regex101. And you can save and copy
>a test page and it will be there for ever! I put Greg's suggestion here:

Or you could use a Pattern Playground. :-)

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Rich Siegel

unread,
Feb 27, 2020, 11:18:31 AM2/27/20
to bbe...@googlegroups.com
>On Thursday, February 27, 2020 at 5:33:45 AM UTC-8, Mohannad Mahmoud wrote:

>>I am trying to copy a search pattern to a new document. I am
>>not sure this can be done in Canonize or Processing Lines Containing

>Does this work for you?
>
>\A.*?\n.*?\n.*?\n.*?\n.*?\n

Note that "Process Lines Containing" works on *lines*, and so
any pattern that requires crossing line boundaries will never match.

However, assuming that you have a matching pattern (which you
can easily test using a Pattern Playground or the Find window
itself), the "Extract" button in the Find window may do what you
need; leave the "Replace" field blank and click that button, and
all of the matches for the pattern will be copied to a new window.

Kaveh Bazargan

unread,
Feb 27, 2020, 12:19:17 PM2/27/20
to bbe...@googlegroups.com

Yes, should have mentioned Pattern Playground. I have not used that enough yet. Too many good features in BBEdit 13!
Reply all
Reply to author
Forward
0 new messages