正規表現を使用してMYSQLデータベースにクエリを実行しようとしています。このパターン1234X32X12の列の下の値を取得しようとしています。
擬似コードをいくつか書いたのですが、正規表現に慣れていないので、誰かに助けてもらえるといいなと思っていました。
コード:
if ($transposed_array[$i][0] starts with number)
{
$sid = regex something /^[0-9]*/
$gid = regex something /X[0-9]*X/
$gid = remove first and last character from $gid
$qid = regex something /[0-9]*$/
$question_text = mysql_query("select question from table where sid = ".$sid." and gid = ".$gid." and qid = ".$qid." limit 1");
$transposed_array[$i][0] = $question_test
}
どんな助けでもいただければ幸いです!