fareforce Posted September 19, 2006 Share Posted September 19, 2006 I am having problems with a preg_match. The bit of code I need to match up is:[code]document.images['picture'].src = "images/" + Views[View] + "3.png";[/code]The code I tried is, but it didn't work:[code]preg_match("|src = \"images/\" + Views[View] + \"(.*).png\"|Uis",get_put($url_aurora),$aurora);[/code]I am not very good with php code so I am sure I messed something up. Can anyone help me? Another line of code I could pull this from would be:[code]document.write ('3.png" border="0">');[/code]Any help would be greatly appriciated! =) Quote Link to comment Share on other sites More sharing options...
btherl Posted September 19, 2006 Share Posted September 19, 2006 There's a specific forum for regex questions..I think your problem here is that "+" is a metacharacter. You need to use \+ if you want to match an actual + sign. "[" and "]" also need to be escaped, as \[ and \]. The rest looks ok to me Quote Link to comment Share on other sites More sharing options...
fareforce Posted September 19, 2006 Author Share Posted September 19, 2006 Ok. I tried using:[code]preg_match("|src = \"images/\" \+ Views\[View\] \+ \"(.*)\.png\"|Uis",get_put($url_aurora),$aurora);[/code]but it still isn't working. I guess I should also add the 3 (in the above example) is the variable I am pulling. It can range from 0-10. Quote Link to comment Share on other sites More sharing options...
effigy Posted September 20, 2006 Share Posted September 20, 2006 Works OK for me. Check your input. 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.