16 lines
305 B
Go
16 lines
305 B
Go
package mikrotik
|
|
|
|
import (
|
|
// Standard
|
|
"regexp"
|
|
)
|
|
|
|
func ScriptEscape(source string) (escaped string) {
|
|
rxp2 := regexp.MustCompile("([\"\\\\$])")
|
|
source = rxp2.ReplaceAllString(source, "\\$1")
|
|
|
|
rxp := regexp.MustCompile("\\r?\\n")
|
|
escaped = rxp.ReplaceAllString(source, "\\r\\\r\n \\n")
|
|
return
|
|
}
|