0

I am using preg_match_all in php to try to do some matching replacing and basic templating

My php match code is

preg_match_all( '/\{(.*?)\}/', $message, $match);

the content that is being passed in as $message is

    {1202403}{https://mysite.demo/s/d/avatars/s/0/2.jpg?1510225571}{Dan}{https://mysite.dem/s}{July 15, 2004}{35,422}{10,329}{[QUOTE="Dan - Bb, post: 12023899, member: 287999"]
[st_table="45%"][st_tr][st_td_row="2"][IMG]https://mysite.demo/devsite/d/avatars/s/0/1.jpg?1685962625[/IMG][/st_td_row][st_td][B][SIZE=5]Dan[/SIZE][/B] - [SIZE=3]https://mysite.demo/devsite[/SIZE][/st_td][/st_tr][st_tr][st_td="0.7"][SIZE=2][B]JOINED: [/B]April 24, 2023
                [B]MESSAGES:[/B] 10
                [B]Reaction Score: 0[/B][/SIZE][/st_td][/st_tr][/st_table]
[HR][/HR]
Lts see if this works
[/QUOTE]
test}

It matches everything apart from the last one which seems to go across multiple lines

My expectation is that it should give me 8 matches but it wont do the last one. I tried some alternates including line breaks but then it seems to match the whole as 1 single offset.

I am getting matched as

0   =>  {1202403}
1   =>  {https://manicmedia.ddns.net/silvertails/data/avatars/s/0/2.jpg?1510225571}
2   =>  {Dan}
3   =>  {https://manicmedia.ddns.net/silvertails}
4   =>  {July 15, 2004}
5   =>  {35,422}
6   =>  {10,329}

When I need

0   =>  {1202403}
1   =>  {https://manicmedia.ddns.net/silvertails/data/avatars/s/0/2.jpg?1510225571}
2   =>  {Dan}
3   =>  {https://manicmedia.ddns.net/silvertails}
4   =>  {July 15, 2004}
5   =>  {35,422}
6   =>  {10,329}
7   =>  {[QUOTE="Dan - BroncosHQ, post: 1202384, member: 28791"]
[st_table="45%"][st_tr][st_td_row="2"][IMG]https://silvertails.ddns.net/devsite/data/avatars/s/0/1.jpg?1685962625[/IMG][/st_td_row][st_td][B][SIZE=5]Dan[/SIZE][/B] - [SIZE=3]https://silvertails.ddns.net/devsite[/SIZE][/st_td][/st_tr][st_tr][st_td="0.7"][SIZE=2][B]JOINED: [/B]April 24, 2023
                [B]MESSAGES:[/B] 10
                [B]Reaction Score: 0[/B][/SIZE][/st_td][/st_tr][/st_table]
[HR][/HR]
Lts see if this works
[/QUOTE]
test}

I know its a matter of getting my regex right but I just can't seem to figure that out and would appreciate any advice

Dan

Dannymh
  • 149
  • 1
  • 11

0 Answers0