Robin Rodricks
Robin Rodricks

Reputation: 113946

Regex to match one or more characters

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

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?

Upvotes: 5

Views: 18400

Answers (2)

Noctis
Noctis

Reputation: 11763

You want the .

For example: he.lo will match your hello, but not helo.

same goes for the rest.

You can easily test it here: http://regexpal.com/.

Do note that .yp. will not match typical nor gypsy, but `.yp.+' will (because of the rest of the characters)

Upvotes: 1

arpl
arpl

Reputation: 3633

What you're looking for is the + regex operator

Upvotes: 9

Related Questions