Help with regexmatch
Help with regexmatch
Could anyone please tell me the regexmatch to remove part of the filename of a series of files. It should remove everything from the first "_" to the second "_" found, both "_" included. Thank you very much.
Re: Help with regexmatch
Code: Select all
#Requires AutoHotkey v1.1.36.02
MsgBox % RegExReplace("aaaaa_bbbb_CCCC", "_[^_]+_") ; aaaaaCCCC
Re: Help with regexmatch
Thank you, but in this case also other "_" after that are also removed:
result: aaaaCCCCeeee.mp4
expected: aaaaCCCC_dddd_eeee.mp4
Code: Select all
MsgBox % RegExReplace("aaaaa_bbbb_CCCC_dddd_eeee.mp4", "_[^_]+_")
expected: aaaaCCCC_dddd_eeee.mp4
Re: Help with regexmatch
Code: Select all
MsgBox % RegExReplace("aaaaa_bbbb_CCCC_dddd_eeee.mp4", "_[^_]+_", , , 1) ; aaaaaCCCC_dddd_eeee.mp4
Re: Help with regexmatch
Thank you very much. It works great.
Finally (and sorry to bother you again), how would it be to have this transformation?
aaaaa_bbbb_CCCC_dddd_eeee.mp4 --> aaaaa_CCCC_dddd_eeee.mp4
Finally (and sorry to bother you again), how would it be to have this transformation?
aaaaa_bbbb_CCCC_dddd_eeee.mp4 --> aaaaa_CCCC_dddd_eeee.mp4
Re: Help with regexmatch
Code: Select all
MsgBox % RegExReplace("aaaaa_bbbb_CCCC_dddd_eeee.mp4", "_[^_]+(?=_)", , , 1) ; aaaaa_CCCC_dddd_eeee.mp4
Re: Help with regexmatch
Thank you so much!
Who is online
Users browsing this forum: pgeugene and 63 guests