我从亚马逊乔治·迈克尔的DVD轨道目录的$str
剪切和粘贴和随后的代码通过分裂来处理它的前两位,其余:分割线分为两个部分
$str = "20 Fastlove 21 Jesus To A Child 22 Spinning the Wheel 23 Older 24 Outside 25 As (with Mary J. Blige) 26 Freeek! 27 Amazing 28 John and Elvis are Dead 29 Flawless (Go To The City) 30 Shoot The Dog 31 Roxanne 32 An Easier Affair 33 If I Told You That (with Whitney Houston) 34 Waltz Away Dreaming 35 Somebody To Love 36 I Can’t Make You Love Me 37 Star People '97 38 You Have Been Loved 39 Killer/ Papa Was A RollIn Stone 40 Round Here";
while ($str =~ /(\d{2}) (\S+)/g) {
print "$1 $2\n";
}
结果:
20 Fastlove
21 Jesus
22 Spinning
23 Older
24 Outside
25 As
26 Freeek!
27 Amazing
28 John
29 Flawless
30 Shoot
31 Roxanne
32 An
33 If
34 Waltz
35 Somebody
36 I
37 Star
97 38
39 Killer/
40 Round
上述类型的作品,但不包括完整曲目名称。有关如何获得我想要的结果的任何建议?我期待,或希望的结果是:
20 Fastlove
21 Jesus To A Child
22 Spinning the Wheel
[etc.]
无法理解这个问题。 – tchrist 2010-11-29 00:22:28
不能可靠地完成,因为歌曲名称中没有数字。 – 2010-11-29 00:23:52
为什么不使用像CDDB这样的轨道信息数据库而不是向亚马逊寻求信息? – Ether 2010-11-29 18:56:16