472,119 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

String search help

Hi All

I need a regular expression that retrieves the string that appears
after the "/"

As a example consider the following
Input Output
------ -------
(a/b)/c -------->c
a/b*100*(1-((c*d)/e))----->b,e
(a)-(((b)*(100-c))/(d))/((a)-(((b)*(100-c))/(d))+b*(100-c)/d---->d and

((a)-(((b)*(100-c))/(d))
((a)-(((b)*(100-c))/(d))---->d

(a+b)/((c-d)+e)*100----->((c-d)+e)
((a/b)/c)+d-----b,c
(a+b)/(c+d+e-f)*100-----(c+d+e-f)
(a+b)/((c-d)+e)*100-----((c-d)+e)

Dec 8 '06 #1
4 1045
wrote on 08 dec 2006 in microsoft.public.inetserver.asp.general:
Hi All

I need a regular expression that retrieves the string that appears
after the "/"
want?
As a example consider the following
[..]
((a)-(((b)*(100-c))/(d))---->d

(a+b)/((c-d)+e)*100----->((c-d)+e)
Your specification is inconsistent.

Why is the first output not (d) ?

Without a logical discription, programming is impossible.

A rule shoud be something like:

'Retrieve all substrings
between a "/" and (the next "/" or the end of string)'
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 8 '06 #2

<ka*****@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi All

I need a regular expression that retrieves the string that appears
after the "/"

As a example consider the following
Input Output
------ -------
(a/b)/c -------->c
a/b*100*(1-((c*d)/e))----->b,e
(a)-(((b)*(100-c))/(d))/((a)-(((b)*(100-c))/(d))+b*(100-c)/d---->d and

((a)-(((b)*(100-c))/(d))
((a)-(((b)*(100-c))/(d))---->d

(a+b)/((c-d)+e)*100----->((c-d)+e)
((a/b)/c)+d-----b,c
(a+b)/(c+d+e-f)*100-----(c+d+e-f)
(a+b)/((c-d)+e)*100-----((c-d)+e)
Can you explain why you want to do this?
Why is it relevant to ASP?
Are trying to build a parser? If so you'd be better off with a State
Machine than regular expressions.
Dec 8 '06 #3
I am doing an application in ASP and i go get the input as i specified
and i have to display the output as specified
Anthony Jones wrote:
<ka*****@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi All

I need a regular expression that retrieves the string that appears
after the "/"

As a example consider the following
Input Output
------ -------
(a/b)/c -------->c
a/b*100*(1-((c*d)/e))----->b,e
(a)-(((b)*(100-c))/(d))/((a)-(((b)*(100-c))/(d))+b*(100-c)/d---->d and

((a)-(((b)*(100-c))/(d))
((a)-(((b)*(100-c))/(d))---->d

(a+b)/((c-d)+e)*100----->((c-d)+e)
((a/b)/c)+d-----b,c
(a+b)/(c+d+e-f)*100-----(c+d+e-f)
(a+b)/((c-d)+e)*100-----((c-d)+e)

Can you explain why you want to do this?
Why is it relevant to ASP?
Are trying to build a parser? If so you'd be better off with a State
Machine than regular expressions.
Dec 9 '06 #4
wrote on 09 dec 2006 in microsoft.public.inetserver.asp.general:
I am doing an application in ASP and i go get the input as i specified
and i have to display the output as specified
1 do not toppost on usenet

2 as a programmer you have a responsibility to your employer,
not simply to do what he wants, but to explain to him what the
possibilities are and aren't. Even if it is against your immediate
financial gain. You are the expert.

3
>>(a)-(((b)*(100-c))/(d))/((a)-(((b)*(100-c))/(d))+b*(100-c)/d---->d and
Learn about string parsing first.

Reading up on Shunting yard algorithm and
reverse Polish notation will help you:

<http://en.wikipedia.org/wiki/Shunting_yard_algorithm>
<http://en.wikipedia.org/wiki/Reverse_Polish_notation>

Then make your code to translate your string using the principles
of stack pushing and pulling involved.

4 even so it is not related to ASP, but can be done on any platform,
using vbs or js or whatever. Choose the appropriate NG for the language.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 9 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by JP SIngh | last post: by
5 posts views Thread by int main(void) | last post: by
10 posts views Thread by B. Williams | last post: by
1 post views Thread by nganglove | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.