Skip to content

Instantly share code, notes, and snippets.

@christian-korneck
Created April 23, 2019 19:09
Show Gist options
  • Save christian-korneck/60905e4cb9836a91f1a8741d84c90371 to your computer and use it in GitHub Desktop.
Save christian-korneck/60905e4cb9836a91f1a8741d84c90371 to your computer and use it in GitHub Desktop.
python package requirements regex
import re
match = re.search(r"(?P<name>[a-zA-Z0-9_-]{1,})(?P<operator>[=><]{2,})(?P<version>[0-9]{1,}[0-9\.]{0,})", "lets-get==1.0.0")
name = match.group("name")
operator = match.group("operator")
version = match.group("version")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment