<?php
$string = 'categoryparameterusedpricing_15';
// look for a match
preg_match("/[categoryparameterusedpricing_\d]/", $key, $matches);
echo $matches[1];
Warning: Undefined variable $key in /in/YpqV4 on line 6
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/YpqV4 on line 6
Warning: Undefined array key 1 in /in/YpqV4 on line 7
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Warning: Undefined variable $key in /in/YpqV4 on line 6
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/YpqV4 on line 6
Warning: Undefined array key 1 in /in/YpqV4 on line 7
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $key in /in/YpqV4 on line 6
Warning: Undefined array key 1 in /in/YpqV4 on line 7