String search help

String search help

am 08.12.2006 07:28:59 von kalyan kamesh

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)

Re: String search help

am 08.12.2006 09:41:01 von exjxw.hannivoort

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)

Re: String search help

am 08.12.2006 10:33:14 von Anthony Jones

wrote in message
news:1165559339.141570.141970@n67g2000cwd.googlegroups.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.

Re: String search help

am 09.12.2006 05:03:46 von kalyan kamesh

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:
> wrote in message
> news:1165559339.141570.141970@n67g2000cwd.googlegroups.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.

Re: String search help

am 09.12.2006 09:56:37 von exjxw.hannivoort

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:




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)