re = /#EXTVDJ:.*?[0-9]+.*?t>(.*?)<.*?e>(.*?)<.*?\n.*?mp3/
str = '#EXTVDJ:<filesize>16027776</filesize><artist>Kyau & Albert, Steve Brian</artist><title>Reverie (DJ Version)</title><songlength>397.340</songlength>
E:\\Music\\For Sorting\\From USB Stick\\Music\\2017-19\\10932465_Reverie_DJ_Version.mp3
#EXTVDJ:<filesize>14624215</filesize><artist>Paul van Dyk, KINETICA</artist><title>First Contact (Original Mix)</title><songlength>361.739</songlength>
E:\\Music\\For Sorting\\July 2020\\13319740_First_Contact_Original_Mix.mp3
#EXTVDJ:<filesize>16609012</filesize><artist>Solarstone, Meredith Call</artist><title>I Found You (Giuseppe Ottaviani Remix)</title><songlength>410.929</songlength>
E:\\Music\\For Sorting\\From USB Stick\\Music\\2017-19\\9710365_I_Found_You_Giuseppe_Ottaviani_Remix.mp3
#EXTVDJ:<filesize>13277361</filesize><artist>Darude, Ashley Wallbridge, Foux</artist><title>Surrender feat. Foux (Extended Mix)</title><songlength>328.918</songlength>
E:\\Music\\For Sorting\\From USB Stick\\Music\\2017-19\\10161893_Surrender_feat__Foux_Extended_Mix.mp3
#EXTVDJ:<filesize>21313586</filesize><artist>Ciaran McAuley, Clare Stagg</artist><title>All I Want (Mark Sherry Extended Remix)</title><songlength>526.866</songlength>
E:\\Music\\For Sorting\\July 2020\\13446725_All_I_Want_Mark_Sherry_Extended_Remix.mp3
#EXTVDJ:<filesize>15246761</filesize><artist>Cosmic Gate, Denise Rivera</artist><title>Body Of Conflict (Elevven Extended Remix)</title><songlength>377.681</songlength>
E:\\Music\\For Sorting\\July 2020\\12462485_Body_Of_Conflict_Elevven_Extended_Remix.mp3
#EXTVDJ:<filesize>17663564</filesize><artist>Philippe El Sisi, Omar Sherif</artist><title>Demolition (Original Mix)</title><songlength>438.857</songlength>
E:\\Music\\For Sorting\\July 2020\\13498731_Demolition_Original_Mix.mp3
#EXTVDJ:<filesize>13108166</filesize><artist>Alex Kunnari</artist><title>Sundown (Extended Mix)</title><songlength>323.138</songlength>
E:\\Music\\For Sorting\\From USB Stick\\Music\\2017-19\\10689952_Sundown_Extended_Mix.mp3
#EXTVDJ:<filesize>16468045</filesize><artist>Chris Schweizer</artist><title>Don\'t Be Scared (Extended Mix)</title><songlength>408.696</songlength>
E:\\Music\\For Sorting\\July 2020\\13609598_Don_t_Be_Scared_Extended_Mix.mp3
#EXTVDJ:<filesize>15035754</filesize><artist>Dan Stone, Victoriya</artist><title>I Can\'t Tell (Ferry Tayle Extended Remix)</title><songlength>372.702</songlength>
E:\\Music\\For Sorting\\July 2020\\13689560_I_Can_t_Tell_Ferry_Tayle_Extended_Remix.mp3
#EXTVDJ:<filesize>16562928</filesize><artist>Seri, Nifra</artist><title>Edge of Time feat. Seri (Extended Mix)</title><songlength>410.285</songlength>
E:\\Music\\For Sorting\\From USB Stick\\Music\\2017-19\\9090018_Edge_of_Time_feat__Seri_Extended_Mix.mp3
#EXTVDJ:<filesize>15886841</filesize><artist>Claus Backslash</artist><title>Absolute Delusion (Extended Mix)</title><songlength>395.294</songlength>
E:\\Music\\For Sorting\\July 2020\\13741469_Absolute_Delusion_Extended_Mix.mp3
#EXTVDJ:<filesize>18052845</filesize><artist>Sivan, Graham Bell</artist><title>The Sound Of Letting Go (Tribute To Yotam) (Extended Mix)</title><songlength>448.333</songlength>
E:\\Music\\For Sorting\\July 2020\\13674262_The_Sound_Of_Letting_Go__Tribute_To_Yotam__Extended_Mix.mp3
'
subst = '$1 - $2'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html