2009-07-06, 02:34 PM
import re
re.sub(#b([\w ]+)#k,$1,string)
etc. I'm not sure if you need to escape the [] in the replacement string cause I tested it using some online thingy. And I don't know if \w will match a "." which is in Jr. Sentinel. Might just want [.]
Brackets() let you refer to each match by $1, consecutive brackets are $2 etc. like if you look for (#[br])([\w ]*)#[kb] then $1 would be a b, $2 the "Jr. Sentinel".
re.sub(#b([\w ]+)#k,$1,string)
etc. I'm not sure if you need to escape the [] in the replacement string cause I tested it using some online thingy. And I don't know if \w will match a "." which is in Jr. Sentinel. Might just want [.]
Brackets() let you refer to each match by $1, consecutive brackets are $2 etc. like if you look for (#[br])([\w ]*)#[kb] then $1 would be a b, $2 the "Jr. Sentinel".

