parsing "*" - Quantifier {x,y} following nothing

.net, c#

Solution

Did you try using only the string `"*"` as a regular expression? At least that's what causes your error here:

PS Home:\> "a" -match "*"
The '-match' operator failed: parsing "*" - Quantifier {x,y} following nothing..
At line:1 char:11
+ "a" -match  <<<< "*"

The character `*` is special in regular expressions as it allows the preceding token to appear zero or more times. But there actually has to be something preceding it.

If you want to match a literal asterisk, then use `\*` as regular expression. Otherwise you need to specify what may get repeated. For example the regex `a*` matches either nothing or arbitrary many `a`s in a row.

Problem

fails when I try `Regex.Replace()` method. how can i fix it? ``` Replace.Method (String, String, MatchEvaluator, RegexOptions) ``` I try code ``` <%# Regex.Replace( (Model.Text ?? "").ToString(), patternText, "<b>" + patternText + "</b>", RegexOptions.IgnoreCase | RegexOptions.Multiline)%> ```

Original source