Let's say I put the following into a textbox:
1|[Guangzhou Evergrande](//www.gzevergrandefc.com/)|6|5-1-0|+15|**16**
2|[Shandong Luneng](//www.lunengsports.com/)|7|5-1-1|+7|**16**
3|[Qingdao Jonoon](//www.zhongnengfc.com/)|7|4-3-0|+4|**15**
4|[Beijing Guoan](//www.fcguoan.com/)|7|3-3-1|+2|**12**
when I press enter, it would take what's between the [ and ] and ( and ) and put it into new lines like this:
if ($name == "NAME_HERE") $name = "[".$name."](URL_HERE)";
I tried doing preg_match and using this pattern: $pattern = '/^[/'; and $pattern_end = '/^]/'; for the name -- jsut to test -- but I cannot get it to work....
Here is what I have so far:
$string = '1|[Guangzhou Evergrande](//www.gzevergrandefc.com/)|6|5-1-0|+15|**16**';
$pattern = '/\[(.*?\)].*?\((.*?)\)/';
$replacement = 'if ($name == "{1}") $name = "[".$name."]({2})";';
echo preg_replace($pattern, $replacement, $string);
(.*?\)needs to be(.*?)since that bracket is for the subpattern