일부 데이터에 대해 구문 분석 연산을 수행하고 있습니다. 나는이 줄을 데이터베이스에서 가져 가고있다. 이 행의 내용 : [ ]
사이에이 것들이 저자 이름입니다. 하나 이상의 저자가있을 수 있습니다. 그 후 [ ]
, 첫 번째 ,
의 끝에는 저자의 대학이 있습니다.중첩 된 문장의 구문 분석 및 관련 PHP PHP
예 라인이 라인 예컨대
[Joseph, Susan; Forsythe, Stephen J.] Nottingham Trent Univ, Pathogen Res Ctr, Sch Sci & Technol, Nottingham NG11 8NS, England. %#[Cetinkaya, Esin; Ayhan, Kamuran] Oxford Univ, Fac Engn, Dept Food Engn,06110 8NS, England.
, 예상 출력 같아야
Susan Joseph : Nottingham Trent Univ
Stephen J. Forsythe : Nottingham Trent Univ
Esin Cetinkaya : Oxford Univ
Kamuran Ayhan : Oxford Univ
내가 지금 무슨 짓입니다 :
내 코드 어떤 도움이 appriciated됩니다
This code is taking the authors from that line but i cannot related them with their universities
while($row = mysqli_fetch_array($result))
{
echo "<br>";
echo $row['Correspounding_Author'] ;
echo "<br>";
$pattern = '~(?<=\[|\G;)([^,]+),([^;\]]+)~';
if (preg_match_all($pattern, $row['Correspounding_Author'], $matches, PREG_SET_ORDER)) {
print_r(array_map(function($match) {
return sprintf('%s %s', ltrim($match[2]), ltrim($match[1]));
}, $matches));
}
}
.
는