Reputation: 1059
I have following tags available in git.
popup/0.0.998
popup/14.0.999
popup/54.33.99
popup/20160729/0.0.624
popup/20160730/1.55.624
popup/20160930/99.44.783
From these tags I want only following and exclude others tags. That is I want only tags popup/natural_number.natural_number.natural_number
has this format.
popup/0.0.998
popup/14.0.999
popup/54.33.99
I used following command but it is still giving following tags -
Command used:git tag -l 'popup/[0-9]*\.[0-9]*\.[0-9]*'
Giving all tags:
popup/0.0.528
popup/140.42.409
popup/54.323.726
popup/20160729/0.0.624
popup/20160730/1.55.624
popup/20160930/99.44.183
Kindly suggest, How can I achieve this.
Upvotes: 1
Views: 79
Reputation: 48741
git tag
doesn't take a regular expression and the reason that it returns something is because it accepts filename expansions or globbing. You could use grep
instead:
git tag -l | grep -P '^popup/\d+\.\d+\.\d+$'
Upvotes: 2
Reputation: 23327
You probably have to escape backslashes:
popup/[0-9]*\\.[0-9]*\\.[0-9]*
I've tested with grep
and it worked:
$ cat tags
popup/0.0.998
popup/14.0.999
popup/54.33.99
popup/20160729/0.0.624
popup/20160730/1.55.624
popup/20160930/99.44.783
$ cat tags | grep popup/[0-9]*\\.[0-9]*\\.[0-9]*
popup/0.0.998
popup/14.0.999
popup/54.33.99
Upvotes: 0