Skip to content

Instantly share code, notes, and snippets.

@cuevasclemente
Last active August 29, 2015 14:15
Show Gist options
  • Save cuevasclemente/5fc2fd2a6a335a9ed9d4 to your computer and use it in GitHub Desktop.
Save cuevasclemente/5fc2fd2a6a335a9ed9d4 to your computer and use it in GitHub Desktop.
Some of my favorite regexps, with explanations when I can remember them. Not all actually in proper Julia form necessarily
replace(searchstring,r"\w(?=\?)|(\w)$",'?'))
search(r"(?<=\().*?(?=\))", title)
search("(?=, ).*(?<=(is:))",locationstring)
match(Regex("(\\w*.?\\s){$numofwords}"),title)
# Matches a single % sign only when it has no trailing or suceeding % signs
match(r"(?<!\%)\%(?!\%)", string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment