Krol Posted October 30, 2006 Posted October 30, 2006 Have a text with hyperlinks...And long a plain text and quantity of hyperlinks each time a miscellaneous...Addresses of hyperlinks vary:Some text <a href='http://www.somesite1.ru/' target='_blank'>Sometext</a> Some textor <a href='http://www.somesite2.ru/' target='_blank'>Sometext</a> Some text <a href='http://www.somesite3.ru/' target='_blank'>Sometext</a> Some text SometextetcHow to format a line to a plain text without hyperlinks?Clean all <a href ='http: // www.somesite1.ru / ' target = ' _ blank '>
cppman Posted October 30, 2006 Posted October 30, 2006 you mean only get the url? here is a cheap way of doing it: $link = '<a href="http://www.google.com">download.com</a>' $sArray = StringSplit($link, ">") $sArray2 = StringSplit($sArray[1], "=") $Str = StringTrimLeft(StringTrimRight($sArray2[2], 1), 1) MsgBox(0, "", $str) Miva OS Project
Moderators SmOke_N Posted October 30, 2006 Moderators Posted October 30, 2006 (edited) Not url Just text without html tagsCan you supply the "exact" out put. A before and after would be great. Edit:expandcollapse popup#include <array.au3> $string = "<a href='http://www.somesite2.ru/' target='_blank'>Sometext</a> Some text <a href='http://www.somesite3.ru/' target='_blank'>Sometext</a> Some text" $specialconvert = _Convert($string, "\<a href\='", "\>", -1, 1) _ArrayDisplay($specialconvert, 'Array') Func _Convert($sString, $sStart, $sEnd, $vCase, $iSRE) Local $aArray = _StrBetween($sString, $sStart, $sEnd, $vCase, $iSRE) If Not IsArray($aArray) Then SetError(1, 0, 0) For $iCC = 0 To UBound($aArray) - 1 $aArray[$iCC] = "<a href='" & $aArray[$iCC] & ">" Next Return $aArray EndFunc Func _StrBetween($sString, $sStart, $sEnd, $vCase = -1, $iSRE = -1) If $iSRE = -1 Or $iSRE = Default Then If $vCase = -1 Or $vCase = Default Then $vCase = 0 If $vCase <> -1 And $vCase <> Default Then $vCase = 1 Local $sHold = '', $sSnSStart = '', $sSnSEnd = '' While StringLen($sString) > 0 $sSnSStart = StringInStr($sString, $sStart, $vCase) If Not $sSnSStart Then ExitLoop $sString = StringTrimLeft($sString, ($sSnSStart + StringLen($sStart)) - 1) $sSnSEnd = StringInStr($sString, $sEnd, $vCase) If Not $sSnSEnd Then ExitLoop $sHold &= StringLeft($sString, $sSnSEnd - 1) & Chr(1) $sString = StringTrimLeft($sString, $sSnSEnd) WEnd If Not $sHold Then Return SetError(1, 0, 0) $sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1)) Local $aArray[UBound($sHold) - 1] For $iCC = 1 To UBound($sHold) - 1 $aArray[$iCC - 1] = $sHold[$iCC] Next Return $aArray Else If $vCase = Default Or $vCase = -1 Then $vCase = '(?i)' If $vCase <> Default And $vCase <> -1 Then $vCase = '' Local $aArray = StringRegExp($sString, '(?s)' & $vCase & $sStart & '(.*?)' & $sEnd, 3) If IsArray($aArray) Then Return $aArray Return SetError(1, 0, 0) EndIf EndFunc Edited October 30, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now