I hate regular expressions, but for what I am doing I’m sure there is no other simpler option.
Anyway I have been working with this experssion:
/(([a-zA-z_]+)[\.]?+)+/
To try and match something similar to this
"text.lol".something.another etc..
And with preg_match return an array similar to
Array
(
[0] => "text.lol"
[1] => something
[2] => another
)
But instead all I am getting is the first matched item twice in the array?
Can anyone help?
This gives the output you want for the input you specified:
Here’s a full implementation that allows escaped quotes:
Output: