
Untitled
By: a guest on
Jul 20th, 2012 | syntax:
None | size: 0.47 KB | hits: 9 | expires: Never
"find several string with regular expresions
# I would like to find either "-hex", "-mos", or "-sig"
# the result would be -hex, -mos, or -sig
# You see I want to get rid of the double quotes around these three strings.
# Other double quoting is OK.
# I'd like something like.
messWithCommandArgs = ' -o {} "-sig" "-r" "-sip" '
messWithCommandArgs = re.sub(
r'"(-[hex|mos|sig])"',
r"1",
messWithCommandArgs)
r'"(-(?:hex|mos|sig))"'