If you are doing a simple replace like this then using String.Replace would
be faster.
Dim formula as String = "val1 *2/( val3 + val4*12/val1)"
Dim value as Double = 15
formula = formula.Replace("val1", value.ToString())
Else you would use the pattern
val(\d+)
to match your value place holders. This puts the value index in group 1
(Match.Groups(1)) so you know what number to replace the value by.
Robby
"Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
news:uQ*************@TK2MSFTNGP12.phx.gbl...
I have an expression where I need to replace words with values (#'s).
Take the following expression:
val1 *2/( val3 + val4*12/val1)
Given this example how could I replace val1 with the number 15?
Note: the spacing in the above expression was intentional. There may or
may
not be spaces between the variables and the operators but there can NOT be
no space between a variable name and a literal value;