業務でAppStore (iOS), Google Play Store (Android) からアプリ固有のidを抽出する必要があったため備忘録です。Perlでの記述になりますが、正規表現なので他の言語でもほぼ変わらないかと
Google Play Store (Android)
my $android_url = 'https://play.google.com/store/apps/details?id=com.ea.game.maddenmobile15_row&hl=ja';
# 'details?id=bundle& : details?id= に続きかつ、[^&]+ で &を含まないような文字列
print $android_url =~ /details\?id=([^&]+)/ ? "$1\n" : undef;
$ perl android_extract_id_from_url.pl
com.ea.game.maddenmobile15_row
App Store (iOS)
my $ios_url = 'https://itunes.apple.com/us/app/yelp/id284910350?mt=8';
# id に続く数列
print $ios_url =~ /id(\d+)/ ? "$1\n" : undef;
$ perl ios_extract_id_from_url.pl
284910350