Hi guys!! I've to make a program that reads an arithmetical sentence from a textbox, e.g 12.3*34+4*5-3 and then on another textbox identify and display what is the content of the first textbox, for example taking the last ex:

If I have this input:
12.3*34+4*5-3

The output should look like this:

<number>12.3
<operator> *
<number> 34
<operator> +
<number> 4
<operator> *
<number> 5
<operator> -
<number> 3

This program should only read this operators like (+,-,*,/).

I'm have in mind 2 ways of doing it, one with regex and the other taking the first sentence, put it on an array, then trim it, and somehow get the values of the array and identify if it is a number or a decimal number and if it's an operator and then display it.

The difficult part or the part that i can't conceptualize is how to implement it with regex (it should be easier with a regex format than storing it on a array).

I write a bit of code, I used an array to store and then to print the numbers and I used the split function to separate the math operator, but I dunno how to print the operators and the tags.

vb Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim Sentencia As String = TextBox1.Text
  3.         Dim i As Integer
  4.         Dim arryTextBox() As String
  5.  
  6.         TextBox2.Clear()
  7.  
  8.         arryTextBox = Sentencia.Split("+", "-", "*", "/")
  9.  
  10.         For i = 0 To UBound(arryTextBox)
  11.  
  12.             Dim Array As String = arryTextBox(i)
  13.  
  14.             'MsgBox(arryTextBox(i)) 'this msgbox works it prints the values of the array
  15.             TextBox2.Text = TextBox2.Text & Array & vbCrLf
  16.         Next i
  17.        
  18.     End Sub

Btw, I also have the code to validate the input on the textbox ::wink::

Any help will be very appreciated,

Thanks in advanced!!