NITIN PATEL NITIN PATEL - 4 months ago 6
PHP Question

how to get specific value from a string by using regular expression

$str="Indore ->Bhopal ,Check-in: Fri, 22 Apr 2016 7:05 AM Singapore Changi Intl Airport - Terminal 2 Krabi ( KBV ) 11:10 AM Arrive";

I want to get value of Check-in from the whole string can anyone help me out


How about:

preg_match('/Check-in:\s*(.+)\R/', $str, $matches);

The result you want is in group 1 (ie. $matches[1])