0

I have a text paste of a GUI that turn out to form text "blocks", with each line containing different information about a specific entry. For the information I'd like to collect, there are 3 types and I don't know how to handle that. I'm thinking TSV would be a good output format. I'd prefer for the regex to be handled by Notepad++, but if that can't be accommodated, I'd really prefer the regex to be handled by a free and easy to use (& install if s/w) site or software.

The 3 types are in question are with a base price, also with a price on rebate, and no price at all, for all 3 the "block" 1st line should be included; the following contain the input and desired output of each. Here is what I've done so far for the type with both base price & price on rebate: \R0\R\R(\w.*)\R(?:\w.*\R){4}[\w-].*\R.*CDN\$\s(\d+\.\d{2})\RCDN\$\s(\d+\.\d{2})\R(?:\w.*\R){3}.

I had to use code blocks even though the following isn't code as blockquotes clumped lines.

Thank you kindly for your help

INPUT


0

South Park™: The Stick of Truth™
OVERALL REVIEWS:
OVERWHELMINGLY POSITIVE
RELEASE DATE:
3 MAR, 2014
-75%
CDN$ 39.99
CDN$ 9.99
Add to Cart
RPGComedyAdventureFunnyTurn-Based
Added on 8/9/2020 ( remove )

OUTPUT

South Park™: The Stick of Truth™    39.99   9.99

INPUT


0

Grand Theft Auto V
OVERALL REVIEWS:
VERY POSITIVE
RELEASE DATE:
13 APR, 2015
View Details
Open WorldActionMultiplayerAutomobile SimCrime
Added on 1/15/2020 ( remove )

OUTPUT

Grand Theft Auto V      

INPUT


0

System Shock
OVERALL REVIEWS:
NO USER REVIEWS
RELEASE DATE:
SUMMER 2021
CDN$ 51.49
Add to Cart
ActionAdventureCyberpunkSci-fiImmersive Sim
Added on 6/9/2020 ( remove )

OUTPUT

System Shock    51.49   

1 Answer 1

1

Here is a way to do the job:

  • Ctrl+H
  • Find what: 0\R+(.+)\R(?:(?!CDN)(?!^0$)[\s\S])+(?:\RCDN\$\h+(\d+\.\d+))?(?:\RCDN\$\h+(\d+\.\d+))?\R(?:(?!^0$)[\s\S])+
  • Replace with: $1 $2 $3\n
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Demo & explanation

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

1

You must log in to answer this question.

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