String search help

K

kalikoi

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)
 
E

Evertjan.

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)'
 
A

Anthony Jones

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.
 
K

kalikoi

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
 
E

Evertjan.

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

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.
 

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

Members online

No members online now.

Forum statistics

Threads
474,135
Messages
2,570,783
Members
47,339
Latest member
flaviu2

Latest Threads

Top