Jump to content

Remove unusefull text


Recommended Posts

Hello,

extract text from an HTML for extracting text.

Now I want to remove all html codes between < and > symbols.

try to use, without success, stringRegExpReplace :

$mytext = stringRegExpReplace($mytext, "\<(.*)\>", "")

post here an input example

<DIV style="position:absolute;top:459;left:63"><nobr><span class="miostile"><b>di ciccio formaggio</b></span></nobr></DIV>
<DIV style="position:absolute;top:475;left:63"><nobr><span class="miostile"> PAVIA</span></nobr></DIV>
<DIV style="position:absolute;top:499;left:63"><nobr><span class="miostile">Arrestati con la droga al bar<br>Minerva. Tre sudamericani<br>sono stati bloccati con un et-<br>to di «fumo» e con 15 grammi<br>di cocaina. La droga, secondo<br>gli investigatori, era pronta<br>ad essere spacciata. L'arresto<br>è stato movimentato con tan-<br>to di bicchieri rotti e sedie ro-<br>

and output i want to obtain:

di ciccio formaggio
PAVIA
Arrestati con la droga al barMinerva. Tre sudamericani<br>sono stati bloccati con un et-to di «fumo» e con 15 grammidi cocaina. La droga, secondogli investigatori, era prontaad essere spacciata. L'arrestoè stato movimentato con tan-to di bicchieri rotti e sedie ro-

thank you for any help,

m.

Link to comment
Share on other sites

Hi,

Try this :

Local $s = '<DIV style="position:absolute;top:459;left:63"><nobr><span class="miostile"><b>di ciccio formaggio</b></span></nobr></DIV>' & @CrLf & _
'<DIV style="position:absolute;top:475;left:63"><nobr><span class="miostile"> PAVIA</span></nobr></DIV>' & @CrLf & _
'<DIV style="position:absolute;top:499;left:63"><nobr><span class="miostile">Arrestati con la droga al bar<br>Minerva. Tre sudamericani<br>sono stati bloccati con un et-<br>to di «fumo» e con 15 grammi<br>di cocaina. La droga, secondo<br>gli investigatori, era pronta<br>ad essere spacciata. L''arresto<br>è stato movimentato con tan-<br>to di bicchieri rotti e sedie ro-<br>'

ConsoleWrite(StringRegExpReplace($s, "(?s)<(.*?)>", "") & @crlf)

Edit: Seems like the <br> tag does not want to be displayed raw.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...