-topic moved-

Get help with using AutoHotkey and its commands and hotkeys
Yaosr
Posts: 53
Joined: 04 Nov 2017, 04:59

-topic moved-

Post by Yaosr » 17 May 2018, 12:48

-topic moved-
Last edited by Yaosr on 13 Jun 2018, 08:12, edited 1 time in total.
swagfag
Posts: 1221
Joined: 11 Jan 2017, 17:59

Re: remove a special sign

Post by swagfag » 17 May 2018, 13:28

<.*?>|#\w*?\b

Untested
User avatar
TLM
Posts: 1323
Joined: 01 Oct 2013, 07:52

Re: remove a special sign

Post by TLM » 17 May 2018, 13:37

I suggest using a htmlfile object to parse and edit html. For instance:

Code: Select all

html =
(
<html>

<title>some title</title>

<head></head>

<body>
	<div>
		<p>this is some paragraph</p>
	</div>
	<p>this is some other paragraph</p>
	<div>some random div</div>
</body>

</html>
)

msgbox % RemoveTags( "p", html )

Return

RemoveTags( tagName, html )
{
	htmObj 		:= ComObjCreate( "htmlfile" ), htmObj.write( html )
	tagRef 		:= htmObj.getElementsByTagName( tagName )

	While ( tagRef.length >= a_index-1  )
		tagRef[ 0 ].parentNode.removeChild( tagRef[ 0 ] )

	return htmObj.getElementsByTagName( "*" )[ 0 ].innerHTML
}
Using the object is more reliable than trying to replace/remove tags by string.
Post Reply

Return to “Ask For Help”