我一直在寻找一种在这种情况下搜索“dog123”和“cat123”之类的方法,这样我就可以根据需要使用集成平台来删除它们。起初我认为它需要成为使用\“dog123 \”\,[a-z0-9A-Z“,_] *以及其他一些东西来解释结束边界的东西,但我是完全失去了这一点。有没有人有任何建议?最终的结果是再次删除“cat123”之间的每一行文字,
{
"items": [
{
"tableName": "Table0",
"count": 2,
"columnNames": [
"dog123,
"referenceNumber",
"account_id",
"first",
"last",
"street",
"city",
"name",
"name",
"postalCode",
"address",
"number",
"dob",
"lookupName",
"address",
"lookupName",
"lookupName",
"lookupName",
"lookupName",
"awareness_date",
"patient_description",
"date_of_issue",
"lookupName",
"cat123",
"insertion_site",
"lot_number",
答案 0 :(得分:-1)
您没有指定编程语言,但是要使用"dog123",
替换"cat123"
和php
之间的所有内容,您可以尝试:
$new_json = preg_replace('/"dog123",.*"cat123",/sim', '"dog123","cat123",', $old_json);
print $result;
用于python
:
import re
new_json = re.sub('"dog123",.*"cat123",', '"dog123","cat123",', old_json, 0, re.IGNORECASE | re.DOTALL | re.MULTILINE)