정규식 regex.split
Imports System.Text.Regularexpressions
Module Module1
Sub Main()
' The input string.
Dim expression As String = "3 * 5 = 15"
' Call Regex.Split.
Dim operands() As String = Regex.Split(expression, "\s+")
' Loop over the elements.
For Each operand As String In operands
Console.WriteLine(operand)
Next
End Sub
End Module
"10 cats, 20 dogs, 40 fish and 1 programmer."에서
숫자형태만 뽑음
Imports System.Text.Regularexpressions
Module Module1
Sub Main()
' The input string.
Dim sentence As String = "10 cats, 20 dogs, 40 fish and 1 programmer."
' Invoke the Regex.Split shared function.
Dim digits() As String = Regex.Split(sentence, "\D+")
' Loop over the elements in the resulting array.
For Each item As String In digits
Console.WriteLine(item)
Next
End Sub
End Module