Regex to match one or more characters

regex, string

Solution

What you're looking for is the + regex operator

Problem

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?

Original source