开发者

Regex matchin string that containts at least one specific character

开发者 https://www.devze.com 2022-12-12 03:12 出处:网络
I\'m trying to create an expression that matches anything between two whitespaces that does contain at least one - but have no f** idea how to do that.

I'm trying to create an expression that matches anything between two whitespaces that does contain at least one - but have no f** idea how to do that.

Trying things like (?&开发者_开发知识库lt;=\s)[A-Z0-9(\-)+]+(?=\s) don't work at all...

Has anybody a good idea?


Try

(?<=\s)\S*-\S*(?=\s)

You might not even need the look ahead/behind:

\S*-\S*

may work just fine

0

精彩评论

暂无评论...
验证码 换一张
取 消