supermerc Posted August 7, 2009 Share Posted August 7, 2009 Hey once again, I need a preg_match function that will get b726b788e55b9096da3d164580ddf24c out of: <input type="hidden" name="codeid" value="b726b788e55b9096da3d164580ddf24c"> Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/169166-preg_match/ Share on other sites More sharing options...
nrg_alpha Posted August 7, 2009 Share Posted August 7, 2009 Here is one solution: example: $str = '<input type="hidden" name="codeid" value="b726b788e55b9096da3d164580ddf24c">'; preg_match('#<input[^>]*value=[\'"]([a-f0-9]+)[\'"]#i', $str, $match); echo $match[1]; Granted, this makes assumptions that the string value of value only consists of a-f/0-9 one or more times (as this is the only sample you give). Quote Link to comment https://forums.phpfreaks.com/topic/169166-preg_match/#findComment-892618 Share on other sites More sharing options...
nrg_alpha Posted August 7, 2009 Share Posted August 7, 2009 If the value of value can be anything (and this is what you want), you can simply change ([a-f0-9]+) to ([^\'"]+). Quote Link to comment https://forums.phpfreaks.com/topic/169166-preg_match/#findComment-892621 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.