RegEx to split function expressions

  • Thread starter Thread starter Tim Conner
  • Start date Start date
T

Tim Conner

How can I use regex to split an expression like the following :

(Round(340/34.12)*2)

into this list :

(
Round
(
340
/
34.12
)
*
2
)

I could not find a sample to this in .Net help.


Thanks in advance,
 
When you say "like" do you mean exactly or similar.

1) Is the function "Round" always part of the expression or can there be
other functions or even no function?
2) Are all the numbers always in their shown format or can they all be
floating numbers?
3) Are parenthesis optional?
4) Do you allow any operators to be used?
5) Are you looking for the ability to parse ALL mathematical expressions in
the universe?
6) Do you allow whitespace to separate symbols?
 
How can I use regex to split an expression like the following :
(Round(340/34.12)*2)
into this list :
(
Round
(
340
/
34.12
)
*
2
)

I could not find a sample to this in .Net help.

This is effectively a parsing function and RegExp aren't strong enough. Do you
want to handle precendence of operators as well? That is,
A + B * C

What are you really looking to do?

/steveA
Steve Alpert S t e v e _ A l p e r t @ I D X . C O M

-------------------------------------------
NOTICE OF CONFIDENTIALITY
-------------------------------------------
The information in this email, including attachments, may be confidential
and/or privileged and may contain confidential health information. This
email is intended to be reviewed only by the individual or organization
named as addressee. If you have received this email in error please
notify IDX immediately--by return message to the sender or to
(e-mail address removed)--and destroy all copies of this message and any
attachments. Please note that any views or opinions presented in this
email are solely those of the author and do not necessarily represent
those of IDX. Confidential health information is protected by state and
federal law, including, but not limited to, the Health Insurance
Portability and Accountability Act of 1996 and related regulations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

RegEx to split functions 1
Regex : handling single quotes while parsing csv file 4
Regex in C# 4
REGEX 3
RegEx Format Help 4
Newbie question about Regex 8
regular expression 1
Regex help 1

Back
Top