P
Peter
Hi all,
I am searching through directories trying to find the prefix to a
number of files. Unfortunately the files don't have a standard naming
convention yet.
So some of them appear as:
THH307A.Monitoring Public Health Issues.doc ' A single period
THH307A- Monitoring Public Health Issues.doc ' A hyphen, space
THH307A Monitoring Public Health Issues.doc ' A single space
THH307 A.Monitoring Public Health Issues.doc ' A mess
At the moment I can match filenames that have a period or space after
the prefix but can't work out how to also match a hyphen.
This is my regex at the moment:
Dim PrefixRegex As Regex = New Regex("(?<prefix>[^\.| ]+)[\.| ](?
<unitName>.+)")
Can someone help me match the hyphen and maybe even the messy ones
where there could be a space near the end of the unit code.
Many thanks,
Peter.
I am searching through directories trying to find the prefix to a
number of files. Unfortunately the files don't have a standard naming
convention yet.
So some of them appear as:
THH307A.Monitoring Public Health Issues.doc ' A single period
THH307A- Monitoring Public Health Issues.doc ' A hyphen, space
THH307A Monitoring Public Health Issues.doc ' A single space
THH307 A.Monitoring Public Health Issues.doc ' A mess
At the moment I can match filenames that have a period or space after
the prefix but can't work out how to also match a hyphen.
This is my regex at the moment:
Dim PrefixRegex As Regex = New Regex("(?<prefix>[^\.| ]+)[\.| ](?
<unitName>.+)")
Can someone help me match the hyphen and maybe even the messy ones
where there could be a space near the end of the unit code.
Many thanks,
Peter.