0

i'd like to update a table field in my mysql data base and convert all links to lowercase, e.g.

to convert:

http://www.domamain.com/MyLinks/News/FileName.html
to
http://www.domamain.com/mylinks/news/filename.html

Can this be done?

Thanks

peeksey
  • 13
  • 4
  • Should be possible, at least there's some documentation about it: http://dev.mysql.com/doc/refman/5.1/en/regexp.html – Oli Dec 22 '10 at 10:28

1 Answers1

1

You can convert an entire column to lowercase with the LOWER() function

UPDATE mytable
SET url = LOWER(url)

It seems that you can't do regular expression replace in MYSQL though: How to do a regular expression replace in MySQL?

Community
  • 1
  • 1
Jason
  • 9,408
  • 5
  • 36
  • 36
  • Hmmm, would that also work if table field contains other data too and not only url? Like article that contains some text, couple of links and so on? – peeksey Dec 22 '10 at 10:33