Reputation: 1301
I am trying to build a regular expression for a specific name with optional text in the middle. This alone is fairly easy:
^(pom)(.*?)([.]xml)$
However, there is one constraint I would like to have. This may be is possible, perhaps it isn't (I haven't been able to find anything like this). There can be additional text within the file name but if it is there, it has to be preceded with an underscore. The following example should help illustrate what I am trying to get:
pom.xml - SUCCEED
pomdxml - FAIL
pomd.xml - FAIL
pom_asdf.xml - SUCCEED
pom_.xml - FAIL
Thank you in advance for your knowledge and help!
Upvotes: 1
Views: 757