regex - Texwrangler replacement string -
i use reqex expression: \s\.\d
find expression, e.g., ".9" , replace expression "0.9", i.e., part of search pattern part of replacement pattern. avoid replacing .true. 0.true. i've tried replacement patterns such 0.\d puts "d" in replacement string.
you may use &
backreference entire match. if want match dot preceded non-word char , followed digit, may use \b\.\d
, replace 0&
.
however, if use \s\.\d
, want add zero, need capturing group - (\s)(\.\d)
, replace \010\2
(where \01
backreference first capturing group, 0
0 , \2
backreference second capturing group. note approach won't let match @ string start, need add alternative in first group: (^|\s)(\.\d)
^
matches start of string/line.
Comments
Post a Comment