vb.net - Regex.Replace unable to make it work -
i expect following code replace every occurence of whitespace+digit+whitespace replacing anything+digit+anything.
nswapfirstpart = regex.replace(nswapfirstpart, "\w[0-9]\w", " _ ") thanks
you using \w refers non-word character , denoted by
[^a-za-z0-9_] so match special characters, spaces, not alphabet, digit or underscore.
you need use \s denotes whitespace characters , denoted by
[ \t\r\n\v\f] as such, use:
"\s[0-9]\s" instead of
"\w[0-9]\w"
Comments
Post a Comment