Created
February 22, 2009 19:01
-
-
Save jroo/68569 to your computer and use it in GitHub Desktop.
return list of congressional bill numbers extracted from string
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
# return list of bill numbers extracted from string | |
import re | |
def extract_legislation(haystack): | |
haystack = haystack.upper() | |
p = re.compile('S\.?\s?CON\.?\s?RES\.?\s?\d{1,5}|H\.?\s?CON\s?RES\.?\s?\d{1,5}|S\.?\s?J\.?\s?RES\.?\s\d{1,5}|H\.?\s?J\.?\s?RES\.?\s\d{1,5}|S\.?\s?RES\.?\s?\d{1,5}|H\.?\s?RES\.?\s?\d{1,5}|H\.?\s?\R\.?\s?\d{1,5}|S\.?\s?\d{1,5}') | |
needle_list = p.findall(haystack) | |
return needle_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment