Reputation: 39
local szMsg = string.format(" 歡迎來到非常劍俠有獎問答,您隻需交納%s就可以參加本次有獎答題,隻要您能回答正確<color=yellow>%s個<color>關於劍俠世界的小問題,就會獲得%s,如果中途答錯或者自己選擇退出,不僅沒有獎勵,您交納的%s也不會退還。怎麼樣,要參加嗎?", szNeedMoney, self.tbGroup[nGroupId].nQuestionMax, szAwardMsg, szNeedMoney);
local tbOpt =
I want to extract the data between the " "
from my file using PHP.
Upvotes: 0
Views: 146
Reputation: 3822
$string = ' local szMsg = string.format("歡迎來到非常劍俠有獎問答,您隻需交納%s就可以參加本次有獎答題,隻要您能回答正確%s個關於劍俠世界的小問題,就會獲得%s,如果中途答錯或者自己選擇退出,不僅沒有獎勵,您交納的%s也不會退還。怎麼樣,要參加嗎?", szNeedMoney, self.tbGroup[nGroupId].nQuestionMax, szAwardMsg, szNeedMoney); local tbOpt =" '; preg_match('/"([^"]+)"/', $string, $out); $output = str_replace('"', "", $out[0]); echo $output;
This will output:
歡迎來到非常劍俠有獎問答,您隻需交納%s就可以參加本次有獎答題,隻要您能回答正確<color=yellow>%s個<color>關於劍俠世界的小問題,就會獲得%s,如果中途答錯或者自己選擇退出,不僅沒有獎勵,您交納的%s也不會退還。怎麼樣,要參加嗎?
because it's inside the double quotes in $string;
Put your data as $string and you're done!
Upvotes: 1
Reputation: 5101
Give this a try
preg_match('/"(.+)"/',$string,$matches); // puts text into $matches[1]
Upvotes: 1