Regular Expression to select everything before and up to a particular text
After executing the below regex, your answer is in the first capture.
/^(.*?)\.txt/
This matches everything up to ".txt" (without including it):
^.*(?=(\.txt))
After executing the below regex, your answer is in the first capture.
/^(.*?)\.txt/
This matches everything up to ".txt" (without including it):
^.*(?=(\.txt))