1. Executing the generated SQL works locally on Windows 10, but in the Linux container, no records are found. The records printed under Windows 10 are shown in Figure 1.

$rawSchema = ThemeAssetEntity::select('schema')
->where('theme_id', '=', $this->getThemeId())
->where('category', '=', ThemeAssetEntity::CATEGORY_PAGE)
->where('asset_key', 'regexp', $this->themeLayout->getTemplateExtensionsPattern($basename))
->first();
var_dump($rawSchema);
exit;
2. Printing the records under the Linux container returns NULL. As shown in Figure 2.

3. I decided to print the generated SQL, which required removing ->first() for comparison. The outputs for Windows 10 and Linux are shown below. After executing the SQL from Linux in MySQL, the query result is NULL. The difference lies between pages/\ and pages//. As shown in Figure 3.

$rawSchema = ThemeAssetEntity::select('schema')
->where('theme_id', '=', $this->getThemeId())
->where('category', '=', ThemeAssetEntity::CATEGORY_PAGE)
->where('asset_key', 'regexp', $this->themeLayout->getTemplateExtensionsPattern($basename));
$query = str_replace(array('?'), array('\'%s\''), $rawSchema->toSql());
$query = vsprintf($query, $rawSchema->getBindings());
dump($query);
exit;
select `schema` from `theme_asset` where `theme_id` = '96b1c8b9-5b18-4760-9e26-50ab009ac011' and `category` = 'page' and `asset_key` regexp '^pages/\product_detail(\.blade\.php|\.liquid|\.json)'
select `schema` from `theme_asset` where `theme_id` = '96dcab33-3e1d-4279-ab96-39693f03515f' and `category` = 'page' and `asset_key` regexp '^pages//product_detail(\.blade\.php|\.liquid|\.json)'
4. Analyze the function that generates the regular expression. Printing DIRECTORY_SEPARATOR shows inconsistent results across the two environments: \ and /, respectively.
public function getTemplateExtensionsPattern($basename)
{
$escapeDot = array_map(function($extension){
return str_replace('.', '\\.' ,$extension);
}, $this->getTemplateExtensions());
print_r(DIRECTORY_SEPARATOR);
exit;
return sprintf('^%s%s%s%s', $this->getPageDir(), '/'.DIRECTORY_SEPARATOR, $basename, '('.join('|', $escapeDot) .')');
}
\
/
5. Remove .DIRECTORY_SEPARATOR because it is inconsistent across the two operating systems. Since only / is used in the table, there is no need to escape it. The final generated SQL is now consistent across both operating systems and returns query results. As shown in Figure 4.

public function getTemplateExtensionsPattern($basename)
{
$escapeDot = array_map(function($extension){
return str_replace('.', '\\.' ,$extension);
}, $this->getTemplateExtensions());
return sprintf('^%s%s%s%s', $this->getPageDir(), '/', $basename, '('.join('|', $escapeDot) .')');
}
select `schema` from `theme_asset` where `theme_id` = '96dcab33-3e1d-4279-ab96-39693f03515f' and `category` = 'page' and `asset_key` regexp '^pages/product_detail(\.blade\.php|\.liquid|\.json)'
