我正在尝试使用正则表达式查询 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
}
任何帮助,将不胜感激!