Semnomic Posted September 22, 2017 Share Posted September 22, 2017 I had help on forum getting some code, i have hit a new problem when trying to insert a "&" symbol in the following line of code $rssConverted2 = preg_replace('/-([0-9]{10})/', 'pid=$1', $rssConverted1); the part "pid" above needs to be "&pid" but when i try to use &pid everything breaks. Should i be treating the "&" as some sort of special character ? Quote Link to comment https://forums.phpfreaks.com/topic/305085-regex-question-how-to-replace-special-character/ Share on other sites More sharing options...
Semnomic Posted September 22, 2017 Author Share Posted September 22, 2017 (edited) I answered my own question >> "&pid". works fine http://www.degraeve.com/reference/specialcharacters.php Im learning so was that the correct fix or is there another way to do it ? Edited September 22, 2017 by Semnomic Quote Link to comment https://forums.phpfreaks.com/topic/305085-regex-question-how-to-replace-special-character/#findComment-1551784 Share on other sites More sharing options...
requinix Posted September 22, 2017 Share Posted September 22, 2017 & isn't special, no. If there was a problem then it has to do with how $rssConverted2 is being used, not the preg_replace(). Quote Link to comment https://forums.phpfreaks.com/topic/305085-regex-question-how-to-replace-special-character/#findComment-1551787 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.