I have multiple file names that I need to parse. One commonality between these files is that level (revision) is the last letter before the dot. I need to have a regular expression that that accepts the hyphen (-), also.
Examples of file names:
- 068394B.dwg
- 06841213E.dwg
- 420676-.dwg
try this
The syntax should be the same for c# too
If you need to capture groups, you can use parenthesies to do that.
so for instance:
will capture your number and your code at the end.
you
Matchshould have a collection calledGroupsthe first one will be the full match, where the subsequent ones will be the groups in the parens.more details at This reference page
Here’s a sample