Search & Replace

42 views
Skip to first unread message

R B COHEN

unread,
Nov 15, 2021, 4:18:55 PM11/15/21
to BBEdit Talk
1 _GCID 94D0C28F-7346-4AC7-96D1-147294BADAF1
FIND: Entire line where alphanumic (with hyphen) varies per. 
REPLACE: with nothing, move next line up in its place.

Have over 61,000 of them! So once I know it works with Replace, would like to use Replace All.

I then need to Find & Replace:
FIND: 1 AFN  123.123.123 
REPLACE:
1 FACT 123.123.123  \n
2 TYPE Reference
(in all cases, the alphanumeric following FACT must match the AFN )
Not sure if I need a second \n after "Reference". The example of "123.123.123" has two other scenarios so would run this 3 times using Replace & Find.

Christopher Stone

unread,
Nov 15, 2021, 8:49:06 PM11/15/21
to BBEdit-Talk
On Nov 15, 2021, at 15:18, R B COHEN <rbclov...@gmail.com> wrote:

1 _GCID 94D0C28F-7346-4AC7-96D1-147294BADAF1


Hey R B,

Is this the start of the line?

Are these always _GCID numbers?

Is the hyphenated alphanumeric string always 36 characters?

Something like this:

Find:

(?-i)^.*[0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12}.*\n?

Replace:

Nothing

I then need to Find & Replace:

FIND:

1 AFN  123.123.123 

REPLACE:

1 FACT 123.123.123  \n
2 TYPE Reference

Something like this:

Find:

(\d+)\h+AFN\h+\b(\d+\.\d+\.\d+)\b

Replace:

\1 FACT \2\n2 TYPE Reference\n

--
Best Regards,
Chris

R B Cohen

unread,
Nov 15, 2021, 8:54:36 PM11/15/21
to BBEdit Talk
GEDitCom finally replied that there is option to turn the code off. Had no idea! So that deletes needing to replace the  1 _PLACE and the unique id 1 _GCID. I'm left with the 1 AFN.  Will try your suggestion.
Reply all
Reply to author
Forward
0 new messages