Home > Mobile >  Regex to match numbers and periods within quotes
Regex to match numbers and periods within quotes

Time:07-29

I will admit I am new to regex but i cant figure this one out.

I am trying to regex the "tag_name" contents to grab the numbers and peroids only from the github api so i can manage and track versioning though my python app. They appear like this when accessing the api / json;

 "tag_name": "jenkins-docker-packaging-2.235.1",

When i use the regex;

\"tag_name\":\s\"(\S (\S.*))\",

I would like to grab the numbers and peroids only, but it only matches the 1 at the end like this;

Screen capture of result

Which has me stumped because i thought the (\S.*) group would capture any character while being greedy.

Any help greatly appreciated.

CodePudding user response:

Start with "tag_name" and get the [0-9.] after -

^"tag_name".*\-([0-9.] )
  • Related