I want to know if a string is in another string at least once.
I want to check if Shadowbox.init
then any (optionnal) combisaison of whitespace then (
is inside $myString at least once.
- Shadowbox.init must be found (case sensitive)
- It can be followed by any number of white spaces (spaces, tabs, newlines...)
- The whitespaces or
init
is then followed by an opening parenthesis(
So far I have:
$matches = preg_match('/Shadowbox.init[\s]*(/', $myString);
Some examples:
/*
Shadowbox.init(); --> OK
Shadowbox.init ( ); --> OK
Shadowbox.init (foo); --> OK
Shadowbox.init ); --> Bad missing (
Shadowbox.init --> Bad missing (
Shadowbox. init(); --> Bad space after dot
*/