This pattern with __FILE__
under preg_quote( $str, '/' )
/^C\:\\xampp\\apps\\wordpress\\htdocs\\wp\-content\\themes\\themename\\inc\\fonts\/uploads\/[^\/\\]+(\/|\\)/
is not matching this directory path
C:\xampp\apps\wordpress\htdocs\wp-content\themes\themename\inc\fonts/uploads\BELLABOO\
here (just exclude BELLABOO\BELLABOO-Regular.otf
)
C:\xampp\apps\wordpress\htdocs\wp-content\themes\themename\inc\fonts/uploads\BELLABOO\BELLABOO\BELLABOO-Regular.otf
But upon doing this with custom pattern, it is matching:
$pattern = '/.+inc(\/|\\\\)fonts(\/|\\\\)uploads(\/|\\\\)[^\/\\\\]+(\/|\\\\)/';
// $pattern = '/^C\:\\xampp\\apps\\wordpress\\htdocs\\wp\-content\\themes\\themename\\inc\\fonts\/uploads\/[^\/\\]+(\/|\\)/'; Not working!
preg_match( $pattern, $font_path, $matches );
echo $matches[0]; // C:\xampp\apps\wordpress\htdocs\wp-content\themes\themename\inc\fonts/uploads\BELLABOO\
How to make it work with the first pattern?