How to match two character at a time in regex?


Closed. This question needs details or clarity. It is not currently accepting answers. ---------------Answer---------------

Try this:

x = re.sub( r".*(CM).*",r"\1", txt )
---------------Answer---------------

Try this, re.findall(r'cm', 'abcdefghijklmnopqrstuvwxyz')

I generated it using https://askjarvis.io/protected/demo.html, you can also do it if it doesn't exactly answer what you are trying to do.

---------------Answer---------------

Try the following:

import re
PAT = re.compile(“(?P<unit>:cm|CM)”)
x = PAT.sub(“  “, txt)
---------------Answer---------------

Try this :

import re
txt = "The L56MM 56x56 5.6CM rain in MM Spain C"
re.search('CM',txt).group(

Previous : MySQL: How do I SUM non duplicates values when doing multiples JOINS
Next : Javascript Is there a way that when I push data it doesn't show output the last line?