Search/Replace Question
-
Fellow Notepad++ Users,
Could you please help me with the following search-and-replace problem I am having?
I have a massive PS1 code database which looks like this:
“Darius Gaiden (Japan) {SLPS-00574}”
:SLPS-00574
#P1 Infinite Lives
$801051CC 0009
#P2 Infinite Lives
$80105244 0009
#P1 Infinite Bombs
$801051BE 0003
#P2 Infinite Bombs
$80105236 0003
#P1 Invincibility
$801051A8 007F
#P2 Invincibility
$80105220 007F“Gran Turismo (Japan, Asia) {SCPS-10045}”
:SCPS-10045
#Gran Turismo mode/Infinite Money
$8008DD06 00FF
#Gran Turismo mode/Have B License
$90090854 03030303
$90090858 03030303
#Gran Turismo mode/Have A License
$9009085C 03030303
$90090860 03030303
#Gran Turismo mode/Have A International License
$90090864 03030303
$90090868 03030303
#High Racing Points
$9008DD04 05F5E100“Gran Turismo 2 (Disc 2) (Gran Turismo) (Japan) Rev 1 {SCPS-91327}”
;:SCPS-91327
;This game currently has no cheats“Gran Turismo 2 (Japan) (Test Drive Disc) {PAPX-90054}”
;:PAPX-90054
;This game currently has no cheats“Gran Turismo 2 (Un CD Bonus) (France) {SCED-02904}”
;:SCED-02904
;This game currently has no cheats“Grand Theft Auto (Europe) (EDC Platinum, Collector’s Edition) {SLES-00032}”
:SLES-00032
#Infinite Weapons, Ammo, 99 Lives & Coordinates
$80025F90 00FF
#Open All Cities
$80025F2C 0001
$80025F30 0001
$80025F34 0001
$80025F38 0001
$80025F3C 0001
#Maximum Armour This code gives you maximum armour but you must pick up the armour first
$800A92F0 7FFF
#No Police Activity
$8002B488 0000
#Infinite Lives
$8002B5F2 0063
#Infinite Pistol And Ammo
$8002B5FC FF00“Grand Theft Auto (Europe) {SLES-00032}”
:SLES-00032
#Infinite Weapons, Ammo, 99 Lives & Coordinates
$80025F90 00FF
#Open All Cities
$80025F2C 0001
$80025F30 0001
$80025F34 0001
$80025F38 0001
$80025F3C 0001I would like it to look like this:
“Darius Gaiden (Japan) {SLPS-00574}”
:SLPS-00574
#P1 Infinite Lives
$801051CC 0009
#P2 Infinite Lives
$80105244 0009
#P1 Infinite Bombs
$801051BE 0003
#P2 Infinite Bombs
$80105236 0003
#P1 Invincibility
$801051A8 007F
#P2 Invincibility
$80105220 007F“Gran Turismo (Japan, Asia) {SCPS-10045}”
:SCPS-10045
#Gran Turismo mode/Infinite Money
$8008DD06 00FF
#Gran Turismo mode/Have B License
$90090854 03030303
$90090858 03030303
#Gran Turismo mode/Have A License
$9009085C 03030303
$90090860 03030303
#Gran Turismo mode/Have A International License
$90090864 03030303
$90090868 03030303
#High Racing Points
$9008DD04 05F5E100“Grand Theft Auto (Europe) (EDC Platinum, Collector’s Edition) {SLES-00032}”
:SLES-00032
#Infinite Weapons, Ammo, 99 Lives & Coordinates
$80025F90 00FF
#Open All Cities
$80025F2C 0001
$80025F30 0001
$80025F34 0001
$80025F38 0001
$80025F3C 0001
#Maximum Armour This code gives you maximum armour but you must pick up the armour first
$800A92F0 7FFF
#No Police Activity
$8002B488 0000
#Infinite Lives
$8002B5F2 0063
#Infinite Pistol And Ammo
$8002B5FC FF00“Grand Theft Auto (Europe) {SLES-00032}”
:SLES-00032
#Infinite Weapons, Ammo, 99 Lives & Coordinates
$80025F90 00FF
#Open All Cities
$80025F2C 0001
$80025F30 0001
$80025F34 0001
$80025F38 0001
$80025F3C 0001I want to delete every game from the list which doesn’t have any codes. (Doesn’t have any “$” or “#” symbol)
So it would be something like:
Delete “Game” and everything before the “Next game” if there is no “$” symbol at the beginning of any line before “Next game”Regards
Pap -
In the future, please use the
</>
button while your example text is selected, so that it marks it as code/literal text (that way, your real quotes won’t become smart quotes)This search regex will match any single “game” that does not have any line starting with
#
or$
FIND =(?-s)^".*?"(\R[^#\$].*?$)+?(\R\R|\Z)
You can then replace it with the empty string to delete it.
Search Mode must be regular expression.
(This assumes there is no indentation, and that it’s real ASCII quotes not “smart quotes”, and no blank space between the close-quote and the newline sequence, and that a game ends with an empty line or with the end-of-file)
----
Useful References
-
@PeterJones Thank you, that works except sometimes I’m left with empty titles like this:
"Spyro the Dragon (Japan) (Shokai Genteiban) {SCPS-10083}" :SCPS-10083 #Infinite Timer $8007F3D0 0600 $8007F4A4 0600 #Invincibility $800829FC 0003 #Hundred percent $8007F2BA 00C8 $8008101C 0064 #Infinnite Credit $8007F3C0 0004 "Spyro the Dragon (Japan) Demo {PAPX-90078}" "Spyro the Dragon (Japan) {SCPS-10085}" :SCPS-10085 #Infinite Timer $8007F3D0 0600 $8007F4A4 0600 #Invincibility $800829FC 0003 #Hundred percent $8007F2BA 00C8 $8008101C 0064 #Infinnite Credit $8007F3C0 0004 "Spyro the Dragon Speciale (France) Demo {SCED-01637}" "Spyro x Sparx: Tondemo Tours (Japan) Demo {PCPX-96191}" "Spyro x Sparx: Tondemo Tours (Japan) {SCPS-10128}" :SCPS-10128 #Infinite Health $8006CE04 0003 #Score Gem Max $800697F0 FFFF #Infinite Lives $80069850 0004 #Bonus Screen Infinite time $8006C464 070A #And (rising gradually to jump) airborne $8006CC44 05FF
-
@Papryk-G said in Search/Replace Question:
that works except sometimes I’m left with empty titles
None of your examples showed titles with no lines after the title, sorry.
- FIND =
(?-s)^".*?"(\R[^#\$].*?$)*?(\R\R|\Z)
- FIND =