Re: Similar filename matches in a directory
Posted: 25 Mar 2019 22:23
Well, I can't thank you enough for taking a look at it for me. I appreciate it.
Would you be able to explain these lines to me though? I just want to be able to understand and learn from them. I understand the setting the variable part of the lines, and using the regexreplace, but I'm just not too good with the regular expressions yet to understand these clearly and don't also understand what the \ in front of the replacement part is (\$1 or the \$2).
Would you be able to explain these lines to me though? I just want to be able to understand and learn from them. I understand the setting the variable part of the lines, and using the regexreplace, but I'm just not too good with the regular expressions yet to understand these clearly and don't also understand what the \ in front of the replacement part is (\$1 or the \$2).
Code: Select all
$escaped = regexreplace($id, "([\\.+(){\[^$])", "\$1");
$matches = regexmatches($files, "^" . $escaped . ".*?(?=\r?\n|$)", <crlf>, 1);
$second = regexreplace($match, "^(.*?)~([^.]+)(.*)", "$2");
$secondEscaped = regexreplace($second, "([\\.+(){\[^$])", "\$1");
$files = formatlist(regexreplace($files, "^" . $escaped . ".*?(?=\r?\n|$)", , 1), "e", <crlf>);