Jump to content

how do I extract a matching reg expression from a string


tarlejh

Recommended Posts

So I want to accept a URL that might contain a 7-digit number (e.g. http://www.domain.com/index.php/#1234567). 

 

If it does contain a 7-digit number, I want to grab it from the string and assign it to a variable.  If it does not, I want to assign false.  So how might this be achieved? 

 

Using some string handling function or combination thereof (duh) but can anyone here code it off the top of their head?

 

Thank you in advance for any assistance.

 

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.