擅长:python、mysql、java
<pre><code>ori = "SDP_123_CC[comments]"
rr = re.compile(r"""(.*) #match the string that will be kept, and will be backreference with number 1
[\[\(] #match [ or (
[^\[\]\(\)]* #match anything but not "[]()"
[\]\)]$""",re.X) #match the last ) ]
print re.sub(rr,"\\1",ori)
</code></pre>