Jump to content

Regular Expression Question


kevinkhan

Recommended Posts

<input type=\"hidden\" autocomplete=\"off\" name=\"xhpc_composerid\" value=\"u269995_3\" \/>

 

im trying to extract the value of the xhpc_composerid..

 

How do i go about doing it and what is wrong with this code

 

preg_match('|<input[a-zA-Z =\\\"_]*name=\\\"xhpc_composerid\\\"[ ]*value=\\\"[0-9a-zA-Z]*\\\"[a-zA-Z =\\\"]*/>|', $page, $match);

 

can anybody give me the correct solution and explain how it works

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/223157-regular-expression-question/
Share on other sites

You aren't accounting for the _ in the value.

 

Since you wrote 0-9a-zA-Z and you also need to account for _ you'd be better off writing \w instead.

 

so can somebody write the full correct regex that i can use please..

 

sorry this is the next topic i have to learn...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.