Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #3287
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: get head tag data |
| Date | 2011-04-26 16:14 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-0BCF89.16144426042011@news.aioe.org> (permalink) |
| References | <13d79f2e-d496-4896-ad0b-2ab658818b51@l2g2000prg.googlegroups.com> <ip78b4$g22$1@dont-email.me> |
In article <ip78b4$g22$1@dont-email.me>,
Stanimir Stamenkov <s7an10@netscape.net> wrote:
> Tue, 26 Apr 2011 11:15:51 -0700 (PDT), /kapil/:
>
> > i want to retrieve data that is available in between <head></head>
> > tag...in jsp using programming..
> > any one know that how to fetch that data..??
>
> If you have the whole jsp content in a String variable, you could
> use regular expression, e.g.:
>
> String jspContent;
> ...
> String headContent = jspContent
> .replaceAll("(?s).*<head>(.*)</head>.*", "$1");
> System.out.println(headContent);
>
> You may read the java.util.regex.Pattern class documentation and the
> Java Tutorial lesson on Regular Expressions for more info:
>
> http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
>
> http://download.oracle.com/javase/tutorial/essential/regex/index.html
With some caveats: <http://stackoverflow.com/questions/1732348>.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
get head tag data kapil <kapil.purohit1441@gmail.com> - 2011-04-26 11:15 -0700
Re: get head tag data Stanimir Stamenkov <s7an10@netscape.net> - 2011-04-26 23:01 +0300
Re: get head tag data "John B. Matthews" <nospam@nospam.invalid> - 2011-04-26 16:14 -0400
Re: get head tag data kapil <kapil.purohit1441@gmail.com> - 2011-04-28 02:55 -0700
csiph-web