4
0

update 2023-06-22 06:54:52

This commit is contained in:
Robot 2023-06-22 06:54:52 +02:00
parent 552101bc1a
commit 305738aaf7
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
2 changed files with 8 additions and 8 deletions

View File

@ -178,16 +178,16 @@ final class DailyScripture
private function extract(string $reference): ?string
{
// Use regex to match everything before the chapter:verse part
preg_match('/^(.*?)\s\d+:\d+/', $reference, $matches);
$bookName = trim($matches[1]) ?? '';
preg_match('/^(.*)\s(\d+:\d+|\d+)?$/', $reference, $matches);
$bookName = $matches[1] ?? '';
// Check if the book name is a number
if (is_numeric($bookName) || $bookName === '')
if (is_numeric($bookName) || trim($bookName) === '')
{
return null;
}
return $bookName;
return trim($bookName);
}
/**

View File

@ -152,16 +152,16 @@
private function extract(string $reference): ?string
{
// Use regex to match everything before the chapter:verse part
preg_match('/^(.*?)\s\d+:\d+/', $reference, $matches);
$bookName = trim($matches[1]) ?? '';
preg_match('/^(.*)\s(\d+:\d+|\d+)?$/', $reference, $matches);
$bookName = $matches[1] ?? '';
// Check if the book name is a number
if (is_numeric($bookName) || $bookName === '')
if (is_numeric($bookName) || trim($bookName) === '')
{
return null;
}
return $bookName;
return trim($bookName);
}
/**