1

I have a text file with about 10000 lines of text. The text file is in JSON format. I want to cut (& keep in clipboard) the data found after the ':' colon symbol.

{
"Cust_Data": {
"First Name": "John",
"Last Name": "Doe",
"Email Address": "[email protected]",
"City": "New York City",
"State": "New York"
}.
"Cust_Account": {
"Account Number": "57235286096572",
"Branch Code": "US0163GR",
"Routing Number": "CHAUSA56325",
"Bank Name": "Bank of America",
"SWIFT Code": "SW356FGH6534567",
"Date of Remittance": "04-30-2005"
}.
.....
.....
.....

This is what I want as the result:

    {
    "Cust_Data": {
    "First Name": 
    "Last Name": 
    "Email Address": 
    "City":
    "State":
    }.
    "Cust_Account": {
    "Account Number":
    "Branch Code":
    "Routing Number":
    "Bank Name": 
    "SWIFT Code":
    "Date of Remittance": 
    }.
........
........
........

The clipboard should contain the data that is removed from the text file.

Please suggest me an idea to achieve this in Notepad ++ using Regex, or any other options.

2
  • Replace: :[^{\n]* by :
    – Luuk
    Commented Aug 6, 2023 at 7:39
  • 2
    @Luuk That doesn't copy it to the clipboard.
    – DavidPostill
    Commented Aug 6, 2023 at 7:44

1 Answer 1

2
  • Press Ctrl+F
  • Go to the Mark tab
  • Find what: ^.+\:\s\K(".+)
  • Select Wrap around
  • Search mode: Regular Expression
  • Press Mark All
  • Press Copy Marked Text

Mark tab

  • Go to the Replace tab
  • OReplace with: Leave it empty
  • Press Replace all

Replace tab

The marked texts will be removed from the original file, but clipboard will contain them all. You can then copy them to another file.

2
  • 1
    The capture group is useless and there're no needs to escape the colon.
    – Toto
    Commented Aug 6, 2023 at 8:09
  • @Toto you are 100% about both. Commented Aug 6, 2023 at 8:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .