I have a list of files in a directory. I want to sort them based on a section of their name. All files have the same format where the x could be any amount of digits. How would i go about sorting them based on what is in the second set of parenthesis?
(xxxxxxx)(xxxxxx)(xxxxxxxx).xlsx
I was looking to use regex but i am unsure of the syntax needed.
The only time CLng() would fail, is if the matched value is not a number. This could happen if there’s a file in the directory that does not follow your pattern (xxxxx)(xxxxxx)(xxxx), in which case Regex.Match would return on empty string.
If you loop through the files, the TypeArgument should be String.
The square brackets have a different meaning in regex. If you want to match literal brackets you need to escape them with backslash. \[ \]
CLng can only converts numbers. I don’t know what you mean with figures since to me it means the same thing. Please provide examples.
You should only match digits \d if you want to use CLng(). Remove CLng() if you want to sort by any match in the 4th brackets (wether it’s digits or other characters).
Thank you. was able to sort these using the below. However they are only sorted in the assign activity when i view the properties panel. they dont sort themselves in file exlorer. do you know why this is?