Re: Regular Expression - Part II

Mark Galbreath <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <003101c32b00$e9320670$8d00a8c0@mgalbreathc810>
I'm pretty good with regular expressions, but I can't tell what you are
trying to accomplish.

Mark

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[email protected]] On Behalf Of
karthikeyan.balasubramanian
Sent: Wednesday, June 04, 2003 2:37 PM
To: [email protected]
Subject: Regular Expression - Part II


Hi guys,

I am using this package.  Hopefully people might know that i asked this
doubt few post before. I made some start but just couldnt finish it.

http://jregex.sourceforge.net/gstarted.html#searching

  Help me here.

  I m trying out regular expression which can do something like this in
java.

<input type='checkbox' name='8' value='505'>some dynamic text MATCHING
TEXT</input>

and replaces this with

<input type='checkbox' name='8' value='505' DISABLED>some dynamic text
MATCHING TEXT</input>

I basically want something like this in a string for pattern searching:

String str1 = "<input type='checkbox' name='8' value='505' "; String str2 =
">some dynamic text"; String str3 = "MATCHING TEXT"; String str4="</input>";

Pattern p= new Pattern(str1  str2  str3  str4;);
Replacer r=p.replacer("[$1, $2, $3 DISABLED, $4]");
prodInfo ="<input type='checkbox' name='8' value='505'>some dynamic text
MATCHING TEXT</input>"; String result=r.replace(prodInfo);

I m not very good at regular expression, so i basically know the steps but
just couldnt get the right expression to pass it on to Pattern class.

Any help would be appreciated.

<snip>
I tried this but cant go beyond this.
(?ism)<(\w+ \w+)=(\'\w+\') (\w+)=(\'\w+\') (\w+)=(\'\w+\')>(?s)\w+ </snip>

Looking forward for some response.

Have a great day.

Karthikeyan.

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.