DannyK
DannyK

Reputation: 266

Regex matching a dll but not the directory

I have a conf file that is loading plugins. I need to parse and match a certain plugin in a directory but not others in the same directory:

plugin: c:\program files\application\abc\abc.dll
plugin: c:\program files\application\abc\xyz.dll

I need to match the abc.dll only but due to the fact that the abc is also in the dir name, it matches both lines but I dont want xyz.dll

So I tried: ^plugin:(.*)(abc.dll)

So ^ = start of line, then plugin, then .* anything, then abc escape dot dll.

But it doesnt seem to work. Can anyone help please?

Upvotes: 0

Views: 970

Answers (2)

You would like to use this regexp:

([a-zA-Z0-9-_]*\.dll)

Here is example

Upvotes: 0

ESG
ESG

Reputation: 9425

The problem is the dot in abc.dll. Try escaping it so it's not a wild card.

^plugin:(.*)(abc\.dll)

Upvotes: 1

Related Questions