;Global search and replace on a string ; ;input ; s - String to search and replace in ; find - String to find ; "A scalar string that can contain one of two types of ; information: ; ; * One or more single characters, each of which is ; considered to be a separator. String will be split ; when any of the characters is detected. For example, ; if [find] is " ," String will be split whenever ; either a space or a comma is detected. In this case, ; IDL performs a simple string search for the specified ; characters. This method is simple and fast. ; * If the REGEX keyword is specified, [find] is ; considered to be a single regular expression (as ; implemented by the STREGEX function). This method is ; slower and more complex, but can handle extremely ; complicated [find] strings. ; replace - String to replace find with ; ;keyword input ; /regex - Passed along to strsplit, to control how find is interpreted ; ;return ; copy of s, but each instance of find is replaced by replace. ; function strrep,s,find,replace,regex=regex return,strjoin(strsplit(s,find,/extract,regex=regex),replace) end