By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,668 Members | 1,503 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,668 IT Pros & Developers. It's quick & easy.

RegEx to split function expressions

P: n/a

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,


Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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?

"Tim Conner" <ti*******@hotmail.com> wrote in message
news:OA*************@TK2MSFTNGP10.phx.gbl...

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,

Nov 15 '05 #2

P: n/a
On Mon, 13 Oct 2003 12:24:00 -0500, "Tim Conner" <ti*******@hotmail.com> wrote:

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
se******@idx.com--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.
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.