I have the following strings:
Name-AB_date, Name-XYZ_date, Name-JK_date, Name-AB_gate_date, Name-XYZ_gate_date, Name-JK_gate_date
I need a regex in PHP that will match the following substrings in each of the above strings
AB, XYZ, JK, AB, XYZ, JK
I am currently using this the regex:
(?<=Name-)(.*)(?=_)
However in the case of
Name-AB_gate_date, Name-XYZ_gate_date and Name-JK_gate_date
It is returning
AB_gate, XYZ_gate and JK_gate
How do I get it to just match the following in these three strings?
AB, XYZ and JK
Permlink: http://www.phpliveregex.com/p/96Y