I have a question for the regular show

Asked 2 years ago, Updated 2 years ago, 51 views

{"_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

2022-09-20 15:57

1 Answers

It's a self-answer

(content\b)\":\"(.*?)\",\"(type\b)


2022-09-20 15:57

If you have any answers or tips

Popular Tags
python x 4647
android x 1593
java x 1494
javascript x 1427
c x 927
c++ x 878
ruby-on-rails x 696
php x 692
python3 x 685
html x 656

© 2024 OneMinuteCode. All rights reserved.