Issue
$str = "for(var i = 0; i < aLinks.length; i++) {";
preg_replace( "!\s+!", "", $str );
output: for(vari=0;i
My desired output is
for(var i=0;iaLinks.length;i++){
if I remove the arrow like this $str = "for(var i = 0; i (no arrow here) aLinks.length; i++) {";
then I get the desired output.
Why does the back arrow break the regex?
What I want the regex to do is remove all tabs line breaks and spaces and nothing else. the strings may have operators like < or > etc and I want these to be ignored.
Solution
This was a stupid school boy error. I was viewing the output in a browser so it was interpreting the "<" as a tag and everything after that was invisible. Simply viewing the source in the browser showed it was actually working exactly as expected.
Answered By - Feels Unique Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.