EDIT now handles optional - before the digits.
Use () in the re to create a group, then use that group in the result, for example
str1 ="[not,-35]"
afterRE=re.sub("\[not,(-?\d+)\]",r"[hello,\1]",str1)
result
'[hello,-35]'
In the re, the groups created by () are numbered from 1, and in the replacement string, \1 refers to the first (in this case, only) group and expands to the text of that group. You can nest groups, the numbering is always by the sequence of the opening (. so in an expression like (\d(\d+))
\1 would refer to all the digits, and \2 would refer to the 2nd-onwards digits.