Razor Regex Replace All But Numbers and One Dash Between -
i want include number followed 1 dash , number.
@regex.replace(@a, @"[^0-9+-]", "")
... includes dashes.
replace string this:
text (characters!+-) 11-20 text-dashes-after-not counted to become just:
11-20 the problem allows number of dashes, , want include 1 if between numbers -- number of spaces between first number, dash, , second number.
you can use regex:
@regex.replace(@a, @"^.*?\b(\d+\s*-\s*\d+)\b.*", "$1")
Comments
Post a Comment