Nat*_*utz 19
reReplace(string, "^0*(.*?)0*$", "$1", "ALL")
Run Code Online (Sandbox Code Playgroud)
那是:
^ = starting with
0* = the character "0", zero or more times
() = capture group, referenced later as $1
.* = any character, zero or more times
*? = zero or more, but lazy matching; try not to match the next character
0* = the character "0", zero or more times, this time at the end
$ = end of the string
Run Code Online (Sandbox Code Playgroud)