Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to filter a set of strings with a wildcard-type search, like the following:

  • Looking for He*lo should match "Hello", but not "Helo"
  • Looking for *ant should match "pant" and "want" but not "ant"
  • Looking for *yp* should match "gypsy" and "typical"

The * represents one or more characters. I don't mind a handwritten or regex-based search. Any ideas? The typical .NET approach for wildcards matches 0 or more, but I need 1 or more characters. How can I do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
738 views
Welcome To Ask or Share your Answers For Others

1 Answer

What you're looking for is the + regex operator


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...