Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    420
    Thanks
    18
    Thanked 2 Times in 2 Posts

    quick search/replace

    I'm trying to figure out a quick search and replace on one column of a table for any instance of "\'" with the hexadecimal apostrophe: '

    I tried this, but it didn't work:

    Code:
    UPDATE plantae SET common_name_english = replace(field,'[\\']','[&#39\;]');

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    17,027
    Thanks
    4
    Thanked 2,668 Times in 2,637 Posts
    The documentation doesn't specify that replace accepts a pattern type. You'll probably just want to use \\\' and replace with \'.
    Also, ensure you fix your code; PHP is notorious for this if you don't fix the magic quotes from corrupting the input.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  3. Users who have thanked Fou-Lu for this post:

    turpentyne (11-05-2013)

  4. #3
    Regular Coder
    Join Date
    Aug 2010
    Posts
    420
    Thanks
    18
    Thanked 2 Times in 2 Posts
    Cool... got it fixed.

    Yeah, I dumped in a bunch of content, and ended up with numerous slashes.

    Thanks!


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •