Jump to content

preg_match_all


ohdang888

Recommended Posts

i want to find the text between "{:" and ":}", may be 1 or more instances of this

 

i'm using this php:

$str = "hello {:first_name:} ha, this is {:awesome:} haha";
$do = preg_match_all("/{.*):}/", $str, $matches);

 

which works if theres just one instance, but when you use more than 1 instance (like the above example) it returns:

 

first_name:} ha, this is {:awesome

 

But i want it to return a value of first_name, AND a separate value of "awesome"

 

ideas?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/227236-preg_match_all/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.