Using Lookbehind to remove some information at EOF name
Posted: 2017-10-12 20:56:22
https://regex101.com/r/IgsZfH/3
This is what I have so far.
SampleFileNames:
The RegEx
The Error

And finally the ideal outcome
This is what I have so far.
SampleFileNames:
Code: Select all
SampleFileA-[SortCode].xls
SampleFileB-[SortCode][CRCNum].xls
SampleFileC-[SortCode][OtherSortCode][CRCNum].xls
SampleFileD-Date[CRCNum].xls
SampleFileE-Date.xls
In this example I only want to remove [CRCNum] from the file names.
This is as close as I can get. I just don't know how to use lookbehind properly
Code: Select all
(?<!\-)\[.+?\](\.\w{3}$)
Code: Select all
$1

Code: Select all
<RegExp Error> TRegExpr(Comp): Urecognized Modifier (pos 6)
Code: Select all
SampleFileA-[SortCode].xls
SampleFileB-[SortCode].xls
SampleFileC-[SortCode][OtherSortCode].xls
SampleFileD-Date.xls
SampleFileE-Date.xls