preg_match matching pattern with asterisk (*) in it
To use literal asterisks you have to escape them with backslashes. To match the literal te**ed
you would use an expression like this:
preg_match('/te\*\*ed/i', 'tested', $matches); // no match (te**ed != tested)
But I doubt this is what you wanted. If you mean, match any character, you need to use .
:
preg_match('/te..ed/is', 'tested', $matches); // match
If you really want any two lower case letter, then this expression:
preg_match('/te[a-z]{2}ed/i', 'tested', $matches); // match