keep 1st half of string

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sbrady19
Posts: 337
Joined: 12 Apr 2018, 05:22
Location: Central Florida
Contact:

keep 1st half of string

26 Oct 2021, 06:53

I looped a folder and found this file:
UPM_EVO343_12_Zoned_for_Comfort_Instrumental_Fawcett_Martin_1573160.wav_Stereo.aif

I need to keep everything BEFORE _Instrumental_, so I just need:
UPM_EVO343_12_Zoned_for_Comfort

I tried inStr......cant figure it out. Lil help please. Thanks.
User avatar
mikeyww
Posts: 26857
Joined: 09 Sep 2014, 18:38

Re: keep 1st half of string

26 Oct 2021, 06:56

Code: Select all

file = UPM_EVO343_12_Zoned_for_Comfort_Instrumental_Fawcett_Martin_1573160.wav_Stereo.aif
file := RegExReplace(file, "_Instrumental_.+")
MsgBox, 64, Result, %file% ; UPM_EVO343_12_Zoned_for_Comfort

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: MiM, ntepa, supplementfacts and 145 guests