How to delete all, except predefined values



  • Hi!
    Newbie here.

    I did a search but nothing pops up that shows my case.

    I want to delete all, except certain values.

    Example of such text:

    		The Tetra	Alan Fitzpatrick	B Minor	6	10A	125
    		We Are Forever Young	Alan Fitzpatrick	B♭ Minor	6	3A	126
    		Everyday & Everynight - Kant Remix	Nolan, Amber Jolene	C Major	5	8B	120
    		Lost - Original Mix	Amine Edge & Dance (Sleazy G), DANCE	D Major	9	10B	120
    		Save My Night - Extended Mix	Armin van Buuren	D♭ Minor	7	12A	130
    		Shivers - Frontliner Remix	Armin van Buuren, Frontliner	D♭ Major	8	3B	150
    		Hey Brother - Extended Version	Avicii	G Minor	7	6A	125
    		Wake Me Up - EDX Miami Sunset Remix	Avicii	B Minor	9	10A	128
    		Wake Me Up - Reggae Mix	Avicii	B Minor	7	10A	93
    		Groove Is in the Heart - Alexander Metzger Chillout Mix	Barclay & Cream, Alexander Metzger	E Minor	6	9A	110
    		Going Out Tonight	Basement Freaks	B♭ Minor	9	3A	110
    		Mystica - Original Mix	Blasterjaxx	E Minor	6	9A	128
    		Could You Be Loved - RAC Remix	Bob Marley & The Wailers	G Major	7	9B	198
    		Destiny	Droplex, Breech	D Major	7	10B	125
    		Loving You Is Easy - Radio Edit	Camo & Krooked	F Minor	5	4A	128
    		Winking Wasps - Dario Sorano Remix	Chris David, Dario Sorano	D♭ Minor	8	12A	128
    		Love Me Again (Bass Rayders Remix Edit)	Club Rayza	D Minor	8	7A	128
    		Queen Of Disco - Jerome Robins & Hazzaro Remix	DJ PP, Jerome Robins, Hazzaro	B♭ Minor	10	3A	125
    		Turn Down for What	DJ Snake, Lil Jon	E Major	8	12B	100
    		Gunshot - Jinx in Dub Remix	Dub Pistols, Darrison, Rodney P	G Major	8	9B	170
    		Reckless Ardor - Original Mix	EDX	D♭ Major	7	3B	121
    		Ninja Challenge - Dodge & Fuski Remix	Eptic, Habstrakt, Dodge & Fuski	D♭ Major	9	3B	100
    		Eat Sleep Rave Repeat (feat. Beardyman) - Dimitri Vegas & Like Mike vs. Ummet Ozcan Tomorrowland Remix	Fatboy Slim, Beardyman	G Major	8	9B	130
    		Magic Button	Format:B	B Major	6	1B	124
    		Electric Religion - Original Mix	Framewerk	C Major	5	8B	116
    		Dance Floor - Original Mix	Glitter	D♭ Minor	10	12A	128
    		Never Say Goodbye - Wildstylez Remix	Hardwell, Dyro, Bright Lights	D♭ Minor	9	12A	148
    		Lost	Harvey McKay	D♭ Major	6	3B	123
    		Come On Now (Set It Off) - Original Mix	Tube & Berger, Juliet Sikora	B♭ Minor	8	3A	122
    		UBS - 2013 VIP Mix	K Theory	D♭ Major	9	3B	103
    		Never You Mind	KANT	G Minor	6	6A	120
    		Last Chance - Dirtyphonics Remix	Kaskade, Project 46, Dirtyphonics	E♭ Minor	7	2A	140
    		Tomorrow	Klopfgeister, Capital Monkey	C Major	9	8B	138
    		Feel Like Jumpin - Krossbow Remix	Krafty Kuts, Krossbow	C Major	7	8B	220
    		Turn It Up - Tchami Remix	DJ MERCER, Tchami	A♭ Major	9	4B	122
    		Rvtchet Bitch - Milo & Otis Remix	Brillz, Teddy Tuxedo, Milo & Otis	B Minor	9	10A	108
    		You And I - Stanton Warriors Remix	Fantomen, Mobin Master, Stanton Warriors, Tate Strauss	F♯ Minor	9	11A	130
    		Born & Raised - Harmonika Remix	Neelix, Harmonika	D♭ Major	9	3B	138
    		Gecko	Oliver Heldens	C Major	8	8B	125
    		True Thoughts	Parra for Cuva, Anna Naklab	D♭ Major	6	3B	123
    		Monkey City	Patryk Molinari	E Minor	7	9A	122
    		Fire Fire Fire - ilan Bluestone Remix	Progresia, Linnea Schossow	F Minor	7	4A	130
    		Transformations	Rameses B, Laura Brehm	A Minor	8	8A	140
    		Jacqueline - Chill Mix	Rodg	B Minor	5	10A	100
    		Running To The Sea - Seven Lions Remix	Röyksopp & Susanne Sundfør, Röyksopp, Susanne Sundfør	F♯ Minor	7	11A	138
    		Now You See - Original Mix	Sean Tyas	F Minor	10	4A	134
    		We Like to Party - Original Mix	Showtek	B Minor	9	10A	128
    		Rudeboy - VIP	Sigma, Doktor	D♭ Major	9	3B	117
    		Drone	Smooth	G Major	9	9B	174
    		Applause (Criminal Minds Remix)	Sweat Box	F Minor	7	4A	128
    		Get Down Low - ShockOne Remix	TC	F♯ Major	8	2B	128
    		Digital Playground - Extended Version	Technoboy, Isaac	F Minor	9	4A	150
    		Abyss - VIP	The Prototypes	F Major	10	7B	175
    		Kalavela	Thomas Newson, John Dish	D♭ Major	10	3B	128
    		Show Me Love - Club Mix	Tradelove	A Major	9	11B	128
    		Synergy	Haywyre	G Major	8	9B	105
    		Revolution - Vocal Mix	R3HAB, NERVO, Ummet Ozcan	G Minor	8	6A	128
    

    I only want to keep:

    • A minor
      B minor
      C minor
      D minor
      E minor
      F minor
      G minor
      A Major
      B Major
      C Major
      D Major
      E Major
      F Major
      A♭ Major
      B♭ Major
      C♭ Major
      A♭ minor
      B♭ minor
      C♭ minor
      etc.

    They need to be preserved on the line they are placed.

    How would I do this?



  • Maybe something like this?

    Find what:(?i)^.+([A-G]♭* (?:minor|major)).+$
    replace with: \1
    check regular expression



  • Hello, @bas-curtiz, @ekopalypse and All,

    I suppose that we should include the alteration symbol, as well !

    if we assume that chords are the main ones ( Major / Minor ) and with a bit of formatting, in replacement, we get the following regex S/R :

    SEARCH (?i-s)^.+([A-G])(♭|♯)?\x20+m(inor|ajor).+

    REPLACE \u\1(?2\2:\x20)\x20M\L\3

    and we obtain this list :

    B  Minor
    B♭ Minor
    C  Major
    D  Major
    D♭ Minor
    D♭ Major
    G  Minor
    B  Minor
    B  Minor
    E  Minor
    B♭ Minor
    E  Minor
    G  Major
    D  Major
    F  Minor
    D♭ Minor
    D  Minor
    B♭ Minor
    E  Major
    G  Major
    D♭ Major
    D♭ Major
    G  Major
    B  Major
    C  Major
    D♭ Minor
    D♭ Minor
    D♭ Major
    B♭ Minor
    D♭ Major
    G  Minor
    E♭ Minor
    C  Major
    C  Major
    A♭ Major
    B  Minor
    F♯ Minor
    D♭ Major
    C  Major
    D♭ Major
    E  Minor
    F  Minor
    A  Minor
    B  Minor
    F♯ Minor
    F  Minor
    B  Minor
    D♭ Major
    G  Major
    F  Minor
    F♯ Major
    F  Minor
    F  Major
    D♭ Major
    A  Major
    G  Major
    G  Minor
    

    Notes :

    • Whatever the initial case of the chord letter and whatever the case of the tone, there are changed into an uppercase letter, from A to G and the words Major or Minor, with this exact case

    • The replacement results are lined up

    Best Regards,

    guy038



  • For sure, not only flats but sharps as well. Nice find.



  • @guy038 said in How to delete all, except predefined values:

    \u\1(?2\2:\x20)\x20M\L\3

    @Ekopalypse @guy038
    Thank you guys for thinking along with me!

    @guy038 Does EXACTLY what I want - thanks again.


Log in to reply