PHP - regex between two characters
Hi,
I would need to use php regex to prepare this string from the string below = "77x6v11133-xjrdg"
Hi,
I'm not expert in regular expressions, but if you take a little detour, it would go like this:
Make a php explode into an array according to the "/admin/block" delimiter
and then regex between the "/" and ">" characters
It works...
I would need to use php regex to prepare this string from the string below = "77x6v11133-xjrdg"
HTTP/2 201 server: nginx/1.14.2 content-type: application/json; charset=UTF-8 set-cookie: PHPSESSID=1cp5phpdb0n8qcbn3n5v1mesau; path=/; secure; HttpOnly cache-control: max-age=0, must-revalidate, private date: Tue, 25 Aug 2020 10:38:59 GMT x-csrf-token: oNBYCwWF9YdSLHLN8eTkoyKuoL3ax-YHHp0o_syTv58 allow: POST, GET link: < /admin/block/77x6v11133-xjrdg>; rel="resource" expires: Tue, 25 Aug 2020 10:38:59 GMT
REPLY
Hi,
I'm not expert in regular expressions, but if you take a little detour, it would go like this:
Make a php explode into an array according to the "/admin/block" delimiter
and then regex between the "/" and ">" characters
$arr = explode('admin/block', $string);
$matches = array();
$t = preg_match('/\/(.*?)\>/', $arr[1], $matches);
if (isset($matches[1])) {
return $matches[1];
}
It works...