Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 替换Sql中的正则表达式_Mysql_Regex - Fatal编程技术网

Mysql 替换Sql中的正则表达式

Mysql 替换Sql中的正则表达式,mysql,regex,Mysql,Regex,我有一个Sql表 表1: ======================================== ID Text 1 i am a boy 2 boy!what are you doing? 3 that boy is nice 4 He is a Boy and go to school ID Text 1 i am a Man 2 Man!what are you doing? 3 that M

我有一个Sql表

表1:

========================================

ID     Text
1      i am a boy
2      boy!what are you doing?
3      that boy is nice
4      He is a Boy and go to school
ID     Text
1      i am a Man
2      Man!what are you doing?
3      that Man is nice
4      He is a Boy and go to school
========================================

ID     Text
1      i am a boy
2      boy!what are you doing?
3      that boy is nice
4      He is a Boy and go to school
ID     Text
1      i am a Man
2      Man!what are you doing?
3      that Man is nice
4      He is a Boy and go to school
我想替换单词boy(不区分大小写)。像替补男童到男童然后输出显示

表2:

========================================

ID     Text
1      i am a boy
2      boy!what are you doing?
3      that boy is nice
4      He is a Boy and go to school
ID     Text
1      i am a Man
2      Man!what are you doing?
3      that Man is nice
4      He is a Boy and go to school
========================================

ID     Text
1      i am a boy
2      boy!what are you doing?
3      that boy is nice
4      He is a Boy and go to school
ID     Text
1      i am a Man
2      Man!what are you doing?
3      that Man is nice
4      He is a Boy and go to school

要执行此操作,我需要在Sql中编写什么查询

您可以使用replace命令进行替换,如下所示:

Update tablename Set Text = replace(Text, 'boy', 'Man');

表1

如果这个答案帮助你解决了问题,你应该接受并投票表决。