Community
    • Login

    Hello, I am trying to replace a whole paragraph in many files. But the replace function always truncate the paragraph after the first line.... I tried all different options available... Is there anything I missed?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 615 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Cedric REYMONDC Offline
      Cedric REYMOND
      last edited by

      trying to replace this:
      
      	case 'eng': $dg_language = 'en'; break;
      	case 'fra': $dg_language = 'fr'; break;
      	case 'deu': $dg_language = 'de'; break;
      	case 'pol': $dg_language = 'pl'; break;
      	default: $dg_language = 'en'; break;
      

      with this:
      case ‘eng’: $dg_language = ‘en’; break;
      case ‘fra’: $dg_language = ‘fr’; break;
      case ‘deu’: $dg_language = ‘de’; break;
      case ‘pol’: $dg_language = ‘pl’; break;
      case ‘por’: $dg_language = ‘pt’; break;
      case ‘spa’: $dg_language = ‘es’; break;
      default: $dg_language = ‘en’; break;

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • rinku singhR Offline
        rinku singh
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • Alan KilbornA Offline
          Alan Kilborn @Cedric REYMOND
          last edited by Alan Kilborn

          @Cedric-REYMOND

          You could do it with a “regular expression” search-mode replacement:

          Search on:

          case 'eng': $dg_language = 'en'; break;\Rcase 'fra': $dg_language = 'fr'; break;\Rcase 'deu': $dg_language = 'de'; break;\Rcase 'pol': $dg_language = 'pl'; break;\Rdefault: $dg_language = 'en'; break;\R
          

          Replace with:

          case ‘eng’: $dg_language = ‘en’; break;\r\ncase ‘fra’: $dg_language = ‘fr’; break;\r\ncase ‘deu’: $dg_language = ‘de’; break;\r\ncase ‘pol’: $dg_language = ‘pl’; break;\r\ncase ‘por’: $dg_language = ‘pt’; break;\r\ncase ‘spa’: $dg_language = ‘es’; break;\r\ndefault: $dg_language = ‘en’; break;\r\n
          

          …or something similar since your “whitespace” is hard to determine from your posting.

          If your files are Linux and not Windows, change \r\n to \n in the replace part.

          1 Reply Last reply Reply Quote 1
          • Alan KilbornA Offline
            Alan Kilborn
            last edited by

            Oops, embedded special characters (e.g $) would need to be “escaped” in the search expression; example \$. Note: NOT needed or desired in the “replace” part.

            Sorry for the omission.

            1 Reply Last reply Reply Quote 1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors