luminous Posted June 9, 2010 Share Posted June 9, 2010 I'm rubbish with REGEX, I need help extracting a string between two characters like so: $date = "Wednesday, June 23, 2010"; preg_match ("/[,](.*)[,]/", $date, $matches); which gives me: Array ( [0] => , June 23, [1] => June 23 ) However I only want the second value (without the ',' at the beginning and the end) help me please! Link to comment https://forums.phpfreaks.com/topic/204289-preg-to-get-string-between-to-characters/ Share on other sites More sharing options...
Psycho Posted June 9, 2010 Share Posted June 9, 2010 Help you with what? You already have the value! Although you might want to trim it. $date = "Wednesday, June 23, 2010"; preg_match ("/[,](.*)[,]/", $date, $matches); $valueYouWant = trim($matches[1]); Link to comment https://forums.phpfreaks.com/topic/204289-preg-to-get-string-between-to-characters/#findComment-1070074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.