Regex.Replace(testnumber, "[^\d]", "") is sufficient to remove all non-numeric characters from
Using the Code
The following code was made in VB.NET. Read the numbers as
string, and assign to
testnumber. Then regular expression is applied to
testnumber, expression is "
[^\d]". Except numeric
string, rest of characters are replaced with blank.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim testnumber As String = TextBox3.Text
MessageBox.Show(System.Text.RegularExpressions.Regex.Replace(testnumber, "[^\d]", " "))
The input is as follows:
The output is:
- 1st April, 2014: Initial version