i want to a little stringmanipulat iona nd im looking into regexps. i
couldnt find out how to do:
s = 'poprorinoncoce '
re.sub('$o$', '$', s)
should result in 'prince'
$ is obv the wrng character to use bu what i mean the pattern is
"consonant o consonant" and should be replace by just "consonant" .
both consonants should be the same too.
so mole would be mole
mom would be m etc
couldnt find out how to do:
s = 'poprorinoncoce '
re.sub('$o$', '$', s)
should result in 'prince'
$ is obv the wrng character to use bu what i mean the pattern is
"consonant o consonant" and should be replace by just "consonant" .
both consonants should be the same too.
so mole would be mole
mom would be m etc
Comment