Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex vb.net正则表达式替换多个字符_Regex_Vb.net - Fatal编程技术网

Regex vb.net正则表达式替换多个字符

Regex vb.net正则表达式替换多个字符,regex,vb.net,Regex,Vb.net,是否可以仅使用输入字符串、搜索模式和替换模式,将多个字符替换为其对应的映射(o->0,Z->7,B=8)?使用字典(字符串,字符串)并在循环中字符串。替换: Dim replacementMapper As New Dictionary(Of String, String) replacementMapper.Add("o", "0") replacementMapper.Add("T", "7") replacementMapper.Add("B", "8") Dim inputString

是否可以仅使用输入字符串、搜索模式和替换模式,将多个字符替换为其对应的映射(o->0,Z->7,B=8)?

使用
字典(字符串,字符串)
并在循环中
字符串。替换

Dim replacementMapper As New Dictionary(Of String, String)
replacementMapper.Add("o", "0")
replacementMapper.Add("T", "7")
replacementMapper.Add("B", "8")
Dim inputString = "This is just an example which is completely pointless."
For Each kv In replacementMapper
    inputString = inputString.Replace(kv.Key, kv.Value)
Next