bbunlock Posted May 9, 2008 Share Posted May 9, 2008 I have never needed to use anything like this (finding a string of text) so I have no idea how to do this, I did try going to php.net and looking there and on here but its all just going over my head, I have no doubt this is going to be childs play for one of you guys/gals but my head is now numb with this. can anyone tell me how I would get the following details for this string of text (sent by $_POST) this is an example of what the $_POST woiuld contain http://www.mysite.co.uk/tc_test/_resources/signals/s60-3/indi2/sig2.png and what im looking to extract from it is the "indi2" however the "indi2" could change depending on what was sent, it could be "indi3, indi4, etc" but it will always be indi followed by a number(s) if anyone could help me out that would be great. thanks in advance wayne Quote Link to comment Share on other sites More sharing options...
aCa Posted May 9, 2008 Share Posted May 9, 2008 There is lot information about regex out there. Many easier places then php.net to learn php. Just do a google search for regex php tutorial or somthing. Ok, so now over to your question. If it is allways indi + number you are looking for then a code like this should solve it. preg_match('/indi[0-9]+/i', 'http://www.mysite.co.uk/tc_test/_resources/signals/s60-3/indi2/sig2.png', $result); You can test it at my regex tester at http://regex.larsolavtorvik.com. Hope this helps! Quote Link to comment Share on other sites More sharing options...
bbunlock Posted May 9, 2008 Author Share Posted May 9, 2008 Thanks aCa that worked great, and nice tool by the way regards wayne Quote Link to comment 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.