Reputation: 1085
I tried with [^0-9].*
and [^\d].*
But none of them is working:
I only want to get filename which doesn't contain any numbers, in above case, I need to get BUILDING.txt.
I also tried with
But it only matches the characters instead of the whole filename.
Here is the online tool: https://www.regextester.com/
Tried with remove .
Upvotes: 1
Views: 432
Reputation: 642
The following regular expression should do the job. Since you've requested to only capture the filename of a file not containing numbers (this means only the filename and not the extension of the file).
^([a-zA-Z]+)(?=\.[a-zA-Z])
You can test the above regular expression here:
https://rubular.com/r/NMcMicEmLUKNTB
Upvotes: 1
Reputation: 27743
My guess is that you might be trying to design an expression similar to:
^(?!.*\d).*$
The expression is explained on the top right panel of this demo, if you wish to explore/simplify/modify it, and in this link, you can watch how it would match against some sample inputs step by step, if you like.
Upvotes: 4