Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Regular Expression to filter text from html file

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to get the content words and keywords from a group of .html files. That means, I must have everything in a html file except the html tags and and the things written within them. But, if the tag is a meta tag, then i need to extract the key words specified in it. Tried some stuff, but not leading any where. Can anyone please help me..!
Thanks in advance..!
 
author & internet detective
Posts: 41262
849
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did you try?

I usually build up my regular expressions gradually. Can you match:
  • An open tag
  • A close tag
  • Both
  • an attribute
  •  
    Sheriff
    Posts: 3837
    66
    Netbeans IDE Oracle Firefox Browser
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Wouldn't a HTML parser be more up to the task? I personally wouldn't want to maintain code that parsed HTML using regular expressions.

    I have no experience with HTML parsers personally, but googling for Java HTML parser yields some promising links.
     
    Nitin Menon
    Ranch Hand
    Posts: 88
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sorry for the late reply. I Was away. I got the solution. I wrote regular expressions in a series of steps.
    Thank you Martin and Jeanne..!
     
    Your mind is under my control .... your will is now mine .... read this tiny ad
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic