比方說,我有文字的身體像這樣,這是什麼陣正則表達式
["What Color",["Red","Blue","Green","Yellow","Brown","White"]]
什麼是匹配的顏色
我試試這個
while ($mystring =~ m,/"(.*?)"/|,|[/"(.*?)"|,|/],g);
print "Your Color is : [$1]\n";
正則表達式
有人可以幫我這個perl腳本應該打印
- Your Color is: Red - Your Color is: Blue - Your Color is: Green - Your Color is: Yellow - Your Color is: Brown - Your Color is: White
正則表達式和數組不走在一起。 – BoltClock
爲什麼你不會使用JSON http://search.cpan.org/~makamaka/JSON-2.53/lib/JSON.pm? – hsz