Results 1 to 2 of 2

Thread: Perl search replace single quotes

  1. #1
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Perl search replace single quotes

    using perl on the command line, I want to change a string that includes single quotes to something else.

    Like i want to replace id='dog' to id='cat' hello. I thought I could use

    Code:
     's/dog\'/cat\' hello/g;'
    but it really doesn't like having a single quote within the search/replace section. What am I missing?

  2. #2
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Perl search replace single quotes

    Oh good god, the solution is here

    http://jamesmcdonald.id.au/general/e...m-a-bash-shell

    so in my example to change a single quote to a double quote I use

    Code:
    perl -pi -w -e 's/''\'\''/\"/g;' *.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. You search woman for friend?
    By Nadejdatr322 in forum General Discussion
    Replies: 22
    Last Post: 25-08-2006, 03:59 PM
  2. HEXUS search plugin for Firefox
    By Steve in forum General Discussion
    Replies: 18
    Last Post: 07-11-2005, 02:21 AM
  3. New MSN Search Launched
    By Steve in forum HEXUS News
    Replies: 0
    Last Post: 01-02-2005, 11:13 AM
  4. stopping rogue search engines?
    By micovwar in forum Networking and Broadband
    Replies: 3
    Last Post: 24-09-2004, 02:46 PM

Posting Permissions

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