Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23547

    David
    Participant

    Hello, I often handle some XML files like this:

    P_ARTICLE_DEPTH="125" P_ARTICLE_SPACING_FRONT="0" P_ARTICLE_SPACING_REAR="0" <strong>P_ARTICLE_DESCR1="de_DE@Stromversorgung;en_US@Power supply unit;ru_RU@Источники питания;pl_PL@Zasilacz;zh_CN@电源;es_ES@Alimentación de corriente;fr_FR@Alimentation;it_IT@Alimentatore;nl_NL@Voeding;tr_TR@Güç kaynağı;hu_HU@Tápellátás;da_DK@Strømforsyning;cs_CZ@Zdroj napájení;pt_PT@Fonte de alimentação;sv_SE@Strömförsörjning;ko_KR@전원 공급 장치;no_NO@Strømforsyning;" </strong>P_ARTICLE_DISCONTINUED="0" P_ARTICLE_DISCOUNT="0"

    In the “P_ARTICLE_DESCR1”, there are several languages exist by default. I wanna keep only “en_US@Power supply unit;”. Then I define a macro like this:

    function unExpectedLan()
    {
    document.selection.Replace("de_DE@(.+?);","",eeFindNext | eeReplaceAll | eeFindReplaceRegExp |eeExFindRegexBoost);
    document.selection.Replace("en_EN@(.+?);","",eeFindNext | eeFindReplaceEscSeq | eeReplaceAll | eeFindReplaceRegExp);
    document.selection.Replace("fr_FR@(.+?);","",eeFindNext | eeFindReplaceEscSeq | eeReplaceAll | eeFindReplaceRegExp);
    }

    It works and delete un-expected language texts. But finally, the semi-comma (“) also be deleted. If use Find& Replace function in Emeditor to search “de_DE@(.+?);”, it works correctly and will not delete semi-comma. What’s the reason? Thanks!

    #23548

    Yutaka Emura
    Keymaster

    Hello David,

    If you use “eeExFind…” flags in Find/Replace macros, please use them as a separate parameter like this:

    document.selection.Replace("de_DE@(.+?);","",eeFindNext | eeReplaceAll | eeFindReplaceRegExp, eeExFindRegexBoost);

    If the issue still persists, please let us know.

    Thanks,

    #23550

    Stefan
    Participant

    FROM:——————-
    P_ARTICLE_DEPTH=”125″ P_ARTICLE_SPACING_FRONT=”0″ P_ARTICLE_SPACING_REAR=”0″ P_ARTICLE_DESCR1=”de_DE@Stromversorgung;en_US@Power supply unit;ru_RU@Источники питания;pl_PL@Zasilacz;zh_CN@电源;es_ES@Alimentación de corriente;fr_FR@Alimentation;it_IT@Alimentatore;nl_NL@Voeding;tr_TR@Güç kaynağı;hu_HU@Tápellátás;da_DK@Strømforsyning;cs_CZ@Zdroj napájení;pt_PT@Fonte de alimentação;sv_SE@Strömförsörjning;ko_KR@전원 공급 장치;no_NO@Strømforsyning;” P_ARTICLE_DISCONTINUED=”0″ P_ARTICLE_DISCOUNT=”0″

    TO:—————-
    P_ARTICLE_DEPTH=”125″ P_ARTICLE_SPACING_FRONT=”0″ P_ARTICLE_SPACING_REAR=”0″ P_ARTICLE_DESCR1=”en_US@Power supply unit;” P_ARTICLE_DISCONTINUED=”0″ P_ARTICLE_DISCOUNT=”0″

    TRY:——————–
    document.selection.Replace(“(de_DE|en|EN|fr_FR|ru_RU|pl_PL|zh_CN|es_ES|it_IT|nl_NL|tr_TR|hu_HU|da_DK|cs_CZ|pt_PT|sv_SE|ko_KR|no_NO)@.+?;” , “” , eeReplaceAll | eeFindReplaceRegExp,0);

    HTH? ;-)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.