我试图更新我的mySql
数据库。的Value
值搜索并替换之间的字符串“”后标记
{
"Subject": "Subject here",
"Content": "The content here",
"TextContent": "Here text content goes",
"To": "this is to user<[email protected]>",
"From": "Name of User<[email protected]>"
}
我们做什么,我一直寻找From
标签,然后Replace
的Name of User<[email protected]>
到other user<[email protected]>
。
From
标签后面的值对我而言未知。所以我想要替换""
之间的整个报价。
为我做目前
UPDATE `Table_Name`
SET Value= REPLACE(Value,'Name of User<[email protected]>','other user<[email protected]>')
WHERE Name = 'Name_of_field' && INSTR(Value,'From')>0;
什么,我知道这是错误的方式来做到这一点。请给我建议一种方式,因为在这里我使用的是我未知的Name of User<[email protected]>
。
我将探索使用正则表达式搜索和替换。看看http://stackoverflow.com/questions/986826/how-to-do-a-regular-expression-replace-in-mysql,然后如果你需要正则表达式的帮助,我会发布一个新的问题(用'正则表达式'标记) –
@MartinWilson我正在经历这个。我是'mySql'的新手,所以让我花点时间理解这一点。 –
字段顺序(来自,等等)总是保持不变? – peterm