Contents - Index


Remove (function)

Remove(sSource, sRemoveData, sType) : string

Remove selected characters or a matched regular expression from a string.

sSource - The original source string
sRemoveData - The characters you want to remove (or regular expression)
sType - C = characters, R = Regex

If sType = C, then this function will remove any of the individual characters specified in sRemoveData. If sType is R, then sData is used as a Regular expression and any string(s) that match this regular expression will be removed.

Example 1
 

# Remove unwanted characters
$data = "This guy *sure* has habit of 'Highlighting' just about -everything-"
$data = Remove($data,"*'-","C")
MsgOk msg=$data

 


Example 2
 

# Remove all HTML tags (returning just plain text)
$html = "The <b>latest</b> download of GSAK can be found at <a href='http://www.gsak.net'>gsak.net</a>"
$data = Remove($html,"</?[a-z][a-z0-9]*[^<>]*>","R")
MsgOk msg=$data

 


Also see the Keep() function

Alpha List         Category List