首页 > 解决方案 > regex how to find filename which doesn't contain any numbers?

问题描述

I tried with [^0-9].* and [^\d].* But none of them is working: enter image description here

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 enter image description here But it only matches the characters instead of the whole filename.

Here is the online tool: https://www.regextester.com/

Tried with remove .

enter image description here

标签: regex

解决方案


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.


推荐阅读