Created
February 12, 2014 19:45
-
-
Save mittenchops/8963100 to your computer and use it in GitHub Desktop.
regexes for a number with an optional decimal place+decimal digits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It took 15 tries. | |
digits = re.findall(r'[0-9]+', cleaned_text) | |
digits2 = re.findall(r'[0-9]\d*(\.\d+)?', cleaned_text) | |
digits3 = re.findall(r'[0-9]+((\.([0-9]+))?', cleaned_text) | |
digits4 = re.findall(r'[0-9]+(\.)?([0-9]+)?', cleaned_text) | |
digits5 = re.findall(r'\d+\.?\d*?', cleaned_text) | |
digits6 = re.findall(r'\d+(\.\d*)?', cleaned_text) | |
digits7 = re.findall(r'\d+(\.?\d*)?', cleaned_text) | |
digits8 = re.findall(r'\d+(\.?\d*)', cleaned_text) | |
digits9 = re.findall(r'\d+(\.{1}\d*)?', cleaned_text) | |
digits10 = re.findall(r'[0-9]+(\.{1}[0-9]+)?', cleaned_text) | |
digits11 = re.findall(r'^[0-9]\d*(\.\d+)?$', cleaned_text) | |
digits12 = re.findall(r'[0-9]+[\.{1}[0-9]+]?', cleaned_text) | |
digits13 = re.findall(r'[0-9]+[\.]?[0-9]?', cleaned_text) | |
digits14 = re.findall(r'[0-9]+(\.?[0-9]+)?', cleaned_text) | |
digits15 = re.findall(r'[0-9]+[\.]?[0-9]+', cleaned_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment