Hi everyone !
I'm getting totally crazy !
I'm getting more and more used with REGEX, but tonight, I'm just too confused !
Isn't the "m" modifier supposed to work line by line, so "" is the start of a line, and "$" the end of the same line... What's I'm trying to do is to use preg_replace_callback() to replace everything after a HTML tag and before the end of a line... so normally, it should be something like this : />[<]$/m, but it returns a line with a new line character and the content of the other line up to the "<" character !! Even with [<]? it doesn't work !
I noticed that as soon as I write a "*", it gets mixed up...
Can someone make my hamster run normally ? (funny expression)
Here are some patterns used with preg_replace_callback()... I printed the resultats with print_r() and put them below (some lines were not included because they were empty...)
Here is the string I used :
<html>
no tags $id
</html>
And now :
pattern
results...
/.*$/m
-> <html>
-> no tags $id
-> </html>
/>.*$/m
-> <
-> <
/.*>$/m
-> <html>
-> </html>
/>[<]*$/m
-> >
no tags $id
^^^ There is a /$/?"$?% new line !!!
->
[<]*?$/m
->
no tags $id
^^^ There is a /$/?"$?% new line !!!
-> /html>