Contents - Index


Keep (function)

Keep(sSource, sKeepData, sType) : string

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

sSource - The original source string
sKeepData - The keep string of characters (or regular expression)
sType - C = characters, R = Regex

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

Example 1
 

# Keep just the lower case vowels
$data = keep("The quick brown fox jumped over the lazy dogs","aeiou","C")
MsgOk msg=$data




Example 2
 

# Just keep all the digits found using RegEx
$data = keep("This is cache 19 in a series of 54 caches","\d*","R")
MsgOk msg=$data




Also see the Remove() function

Alpha List         Category List