Last active
September 27, 2018 07:00
-
-
Save guma44/e1ee22b0d308b3cadb437287c79d9380 to your computer and use it in GitHub Desktop.
Some useful regular expressions
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
import re | |
pdb_identification_regex = re.compile("^[1-9][a-zA-Z0-9]{3}$") | |
uniprot_identification_regex = re.compile("^[OPQ][0-9][A-Z0-9]{3}[0-9]$|^[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}$") | |
aminoacid_sequence_regex = re.compile("^[GPAVLIMCFYWHKRQNEDST\n\r]{10,}$", re.I | re.M) | |
float_regex = re.compile(r"^-?(?:\d+())?(?:\.\d*())?(?:e-?\d+())?(?:\2|\1\3)$") | |
int_regex = re.compile(r"^(?<![\d.])[0-9]+(?![\d.])$") | |
email_regex = re.compile(r"(.+@[a-zA-Z0-9\.]+,?){1,}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment