regex - i want to build regular expression to extract substring from string in php


I have a string like this:"date created:12 march 1996phone:33444567Location:california steet 5"

date created,phone andlocation are fixed but their value is changing. I want to extract them from string and want to display them separate.




preg_match('~date created:(.*)phone:(.*)Location:(.*)~', $string, $matches);

People are also looking for solutions to the problem: mysql - Handling optional search parameters in a PHP SQL query


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.

Ask a Question

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.

Similar questions

Find the answer in similar questions on our website.