Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.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字符串替换_Mysql_Regex_Replace_Preg Replace - Fatal编程技术网

MySQL字符串替换

MySQL字符串替换,mysql,regex,replace,preg-replace,Mysql,Regex,Replace,Preg Replace,嘿,使用MySQL从特定列的所有行中删除开头和结尾斜杠的最有效方法是什么 之前: /hello/world/ foo/bar/ /something/else /one/more/* hello/world foo/bar something/else one/more/* 之后: /hello/world/ foo/bar/ /something/else /one/more/* hello/world foo/bar something/else one/more/* …或者这应该用

嘿,使用MySQL从特定列的所有行中删除开头和结尾斜杠的最有效方法是什么

之前:

/hello/world/
foo/bar/
/something/else
/one/more/*
hello/world
foo/bar
something/else
one/more/*
之后:

/hello/world/
foo/bar/
/something/else
/one/more/*
hello/world
foo/bar
something/else
one/more/*

…或者这应该用PHP来完成?

您可以使用来完成这项工作,但我认为最好在数据库之外使用PHP或您选择的任何编程语言来处理这项工作。

您可以使用来完成这项工作,但我认为最好在数据库之外使用PHP或您选择的任何编程语言。

请参阅

您的PHP选项:(我假设获取的行位于
$row

您的PHP选项:(我假设获取的行位于
$row


不需要阵列$行['Field']=trim($row['Field'],'/');应该可以。不需要数组$行['Field']=trim($row['Field'],'/');我们应该做到这一点。