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?



  • 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;



  • This post is deleted!


  • @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.



  • 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.


Log in to reply