Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.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
Vb.net 如何在VisualBasic中查找文本框中的数字_Vb.net_Parsing - Fatal编程技术网

Vb.net 如何在VisualBasic中查找文本框中的数字

Vb.net 如何在VisualBasic中查找文本框中的数字,vb.net,parsing,Vb.net,Parsing,我有一个文本框,文本是“ab1234de524sfe6985dsef456”,我想把这个数组中的所有数字都记下来 像 帮助我,谢谢您可以使用正则表达式。请查看以下用c编写的代码片段# 已转换为Visual Basic: Dim strRegex As String = "\d+" Dim myRegex As New Regex(strRegex, RegexOptions.Singleline) Dim strTargetString As String = "ab1234de524sfe69

我有一个文本框,文本是“ab1234de524sfe6985dsef456”,我想把这个数组中的所有数字都记下来 像


帮助我,谢谢

您可以使用正则表达式。请查看以下用c编写的代码片段#


已转换为Visual Basic:

Dim strRegex As String = "\d+"
Dim myRegex As New Regex(strRegex, RegexOptions.Singleline)
Dim strTargetString As String = "ab1234de524sfe6985dsef456"
Dim list As New ArrayList()
For Each myMatch As Match In myRegex.Matches(strTargetString)
    If myMatch.Success Then
        list.Add(myMatch.Value)
    End If
Next

抱歉,我是tag c#,但我使用的是visual basic。你能帮我转换成visual basic吗,非常感谢这是Java代码:)如果你不知道如何转换@Lulu,你必须正确地标记你的问题。文本看起来像带分隔符s的十六进制数字。
string strRegex = @"\d+";
Regex myRegex = new Regex(strRegex, RegexOptions.Singleline);
string strTargetString = @"ab1234de524sfe6985dsef456";
ArrayList list=new ArrayList();
foreach (Match myMatch in myRegex.Matches(strTargetString))
{
  if (myMatch.Success)
  {
    list.Add(myMatch.Value);
  }
}

list.Dump();
Dim strRegex As String = "\d+"
Dim myRegex As New Regex(strRegex, RegexOptions.Singleline)
Dim strTargetString As String = "ab1234de524sfe6985dsef456"
Dim list As New ArrayList()
For Each myMatch As Match In myRegex.Matches(strTargetString)
    If myMatch.Success Then
        list.Add(myMatch.Value)
    End If
Next