Sign in to follow this  
Followers 0
Krol

How special way to format the text

4 posts in this topic

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 text

or

<a href='http://www.somesite2.ru/' target='_blank'>Sometext</a> Some text <a href='http://www.somesite3.ru/' target='_blank'>Sometext</a> Some text Sometext

etc

How to format a line to a plain text without hyperlinks?

Clean all

<a href ='http: // www.somesite1.ru / ' target = ' _ blank '>

Share this post


Link to post
Share on other sites



Not url

Just text without html tags

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Not url

Just text without html tags

Can you supply the "exact" out put. A before and after would be great.

Edit:

#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 by SmOke_N

[center]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.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0