*>(.*?) b">..." />

Which regular expression to use to extract some words from an HTML text?

If yes consider using a parser However, if this is a "one-off", you may be able to get through with something along the lines of: p^>*>(.*?) b">...

If yes, consider using a parser. However, if this is a "one-off", you may be able to get through with something along the lines of: #*>(.*? )# The above has certain limitations, most notably it does not match b">... nor nested s.

(I am not able to tell whether the mark-up you're trying to parse actually allows nested s—just informing you on possible pitfalls.).

Indeed. This can work for very simple HTML-like strings; using regexps for extracting data from HTML is a nightmare waiting to happen. – Piskvor Dec 7 '10 at 13:41 @Piskvor Exactly.

One should always be very certain that the input is actually suited for expression-based matching before jumping on the RegExp band-wagon. – jensgram Dec 7 '10 at 13:45 This is working great! It was quite obvious but I was looking for a difficult thing... And don't worry, this is not intended to parse large web pages but only some text from a personnal web app.

– Anth0 Dec 7 '10 at 15:00 @Anth0 In that case you should be fine :) – jensgram Dec 7 '10 at 16:21.

Assuming you are using PHP: $html = "some text here" preg_replace("//","", $html).

Don't use regex. If you ask why, there is a very popular SO post that describes what can happen if you try to use regex for parsing HTML. Use your language's HTML or XML parser and extract what you need using existing functionality.

If yes, consider using a parser. The above has certain limitations, most notably it does not match b">... nor nested s.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions