Quantcast
Channel: Need to perform Wildcard (*,?, etc) search on a string using Regex - Stack Overflow
Viewing all articles
Browse latest Browse all 12

Answer by Mark Lakata for Need to perform Wildcard (*,?, etc) search on a string using Regex

$
0
0

The correct regular expression formulation of the glob expression d* is ^d, which means match anything that starts with d.

    string input = "Message";    string pattern = @"^d";    Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);

(The @ quoting is not necessary in this case, but good practice since many regexes use backslash escapes that need to be left alone, and it also indicates to the reader that this string is special).


Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>