php - preg_match post-id
Get the solution ↓↓↓Solution:
You could try using the following regular expression:
"/postid-[0-9]+/"
Example code:
$wholepage = 'foo postid-785645 bar postid-785646 baz';
$matches = array();
$string = preg_match_all("/postid-[0-9]+/", $wholepage, $matches);
print_r($matches);
Result:
Array ( [0] => Array ( [0] => postid-785645 [1] => postid-785646 ) )
I'm using instead of becausepreg_match
stops after it finds the first match.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: object of class stdclass could not be converted to string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.