help in math formula

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
aka_onisama
Forum Newbie
Posts: 1
Joined: Sun Jun 21, 2009 12:10 pm

help in math formula

Post 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
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: help in math formula

Post 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?
Post Reply