Page 1 of 1

help in math formula

Posted: Sun Jun 21, 2009 12:12 pm
by aka_onisama
Dear all.

I'm desigining fininial managment by using vb.net solution, my problem is that I need a regular expression to validate formulas like this one: L1_G1_I1 * (L1_G1_I2 + L1_G1_I4 ),

L means List

G means Group

I means Item

and each one of these with its number is a record in the database,

i have tried to make a regular expression but i have problems with brackets and with the math operators, and below is the regular expression that i made

^(((\w\d|\d\w)(_|\s)){3}(\+|\-|\*|\/)\s*){1,3}$ and it validate this L1_G1_I1 * L1_G1_I2 + L1_G1_I4 +

and what i want is adding brackets and i want the last math operator to be removed..

many thanx

Re: help in math formula

Posted: Sun Jun 21, 2009 12:35 pm
by prometheuzz
A couple of questions first:
Question 1: can there be nested parenthesis? For example: 2*((3/(4+9))*8)
Question 2: can you elaborate a bit more? What are Groups, Lists, Items?
Question 3: can you post some actual examples of your input and indicate what parts of that input need to be matched?