pattern for the following condition in java

Posted by zahir hussain on Stack Overflow See other posts from Stack Overflow or by zahir hussain
Published on 2010-05-29T12:28:22Z Indexed on 2010/05/29 12:32 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

hi

i want to know how to write pattern..

for example :

the word is

   "AboutGoogle AdWords Drive traffic and customers to your site. Pay through Cheque,      Net Banking or Credit Card. Google Toolbar Add a search box to your browser. Google SMS To find out local information simply SMS to 54664. Gmail Free email with 7.2GB storage and less spam. Try Gmail today. Our ProductsHelp Help with Google Search, Services and ProductsGoogle Web Search Features Translation, I'm Feeling Lucky, CachedGoogle Services & Tools Toolbar, Google Web APIs, ButtonsGoogle Labs Ideas, Demos, ExperimentsFor Site OwnersAdvertising AdWords, AdSenseBusiness Solutions Google Search Appliance, Google Mini, WebSearchWebmaster Central One-stop shop for comprehensive info about how Google crawls and indexes websitesSubmit your content to Google Add your site, Google SitemapsOur CompanyPress Center News, Images, ZeitgeistJobs at Google Openings, Perks, CultureCorporate Info Company overview, Philosophy, Diversity, AddressesInvestor Relations Financial info, Corporate governanceMore GoogleContact Us FAQs, Feedback, NewsletterGoogle Logos Official Logos, Holiday Logos, Fan LogosGoogle Blog Insights to Google products and cultureGoogle Store Pens, Shirts, Lava lamps©2010 Google - Privacy Policy - Terms of Service"

I have to search some word...

for example "google insights"

so how to write the code in java...

i just write small code...

check my code and answer my question...

that code only use for find the search word, where is that.

but i need to display some words front of search word and display some words rear of search workd...

similar to google search...

my code is

        Pattern p = Pattern.compile("(?i)(.*?)"+search+"");



    Matcher m = p.matcher(full);

    String title="";



    while (m.find() == true) 

    {

          title=m.group(1);

          System.out.println(title);

    } 

the full is orignal content, search s search word...

thanks and advance

© Stack Overflow or respective owner

Related posts about java

Related posts about regex