Skip to content

Instantly share code, notes, and snippets.

@flo-l
Created October 8, 2013 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flo-l/f11b0f7c54b1633cb8cc to your computer and use it in GitHub Desktop.
Save flo-l/f11b0f7c54b1633cb8cc to your computer and use it in GitHub Desktop.
regex...
s = "pub fn main(some_val: uint, other: str) -> uint"
regex = /^(pub\s+)?fn\s+([a-zA-Z0-9_-]+)\((\s*[a-zA-Z0-9_-]+\s*\:\s*[a-zA-Z0-9_-]+\s*,?)*\)(\s+\-\>\s+(\w+))?/
p s.match regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment