update 2023-06-22 07:54:54
This commit is contained in:
parent
305738aaf7
commit
a1c3b7aacb
@ -177,12 +177,11 @@ final class DailyScripture
|
||||
*/
|
||||
private function extract(string $reference): ?string
|
||||
{
|
||||
// Use regex to match everything before the chapter:verse part
|
||||
preg_match('/^(.*)\s(\d+:\d+|\d+)?$/', $reference, $matches);
|
||||
$bookName = $matches[1] ?? '';
|
||||
// Use regex to match and remove chapter:verse and their variations (if they exist) from the end of the string
|
||||
$bookName = preg_replace('/\s+\d+(:(\d+([,-]\d+)*)?\s*)*$/', '', $reference);
|
||||
|
||||
// Check if the book name is a number
|
||||
if (is_numeric($bookName) || trim($bookName) === '')
|
||||
// If there's no match or the remaining string is empty or numeric, return null
|
||||
if (is_numeric($bookName) || trim($bookName) === '')
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -151,12 +151,11 @@
|
||||
*/
|
||||
private function extract(string $reference): ?string
|
||||
{
|
||||
// Use regex to match everything before the chapter:verse part
|
||||
preg_match('/^(.*)\s(\d+:\d+|\d+)?$/', $reference, $matches);
|
||||
$bookName = $matches[1] ?? '';
|
||||
// Use regex to match and remove chapter:verse and their variations (if they exist) from the end of the string
|
||||
$bookName = preg_replace('/\s+\d+(:(\d+([,-]\d+)*)?\s*)*$/', '', $reference);
|
||||
|
||||
// Check if the book name is a number
|
||||
if (is_numeric($bookName) || trim($bookName) === '')
|
||||
// If there's no match or the remaining string is empty or numeric, return null
|
||||
if (is_numeric($bookName) || trim($bookName) === '')
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user