{"_id":"PI45S5IPABZDOO34LYYK73PEM","content":"life"""text"},{"_id":66V6N5Q6NHTTB3NH3"JTHC4THCJTHC4T \"Life is hard, but don't give up\""",type":"text"},{"_id":"YMY75QVTINHRAAEJ7WCMD5AU"",content":"Today's menu is \:Fried potato vegetable stir-fried hamburger".","type":"text"}
What I want here is data between content and type The original method that I was thinking of was
$pattern = '/content":"([^:])","type/g';
However, this method causes a problem of being cut at the third time. There are a lot of things in the content, so it's hard to cut it into a regular style Content, type, and _id are not included in the text Is there any way?
For your information, I tried to use json instead of regular expression, but sometimes I can't use json because it doesn't complete with json (ex:"}" missing or containing .join()).
regex php
It's a self-answer
(content\b)\":\"(.*?)\",\"(type\b)
© 2024 OneMinuteCode. All rights reserved.