Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5771

    prashob12
    Member

    Hello:

    Please help me to create a macro:

    I want to delete the follwoing:

    (< [^>]+>){1,20} (empty elements)

    but there is a condition i want to delete the above only when it comes in the following parent element i.e..

    ….

    For e.g.

    < ?font Start ?>BUNDESARBEITSGERICHT

    URTEIL< ?font Ende ?>

    The above should apply to all the XML files in a particular path.

    Thanks in Advance

    #5772

    prashob12
    Member

    Please Reply someone can solve this problem & help me out

    #5774

    Yutaka Emura
    Keymaster

    prashob12 wrote:
    Hello:

    Please help me to create a macro:

    I want to delete the follwoing:

    (]+>){1,20} (empty elements)

    but there is a condition i want to delete the above only when it comes in the following parent element i.e..

    ….

    For e.g.

    BUNDESARBEITSGERICHT

    URTEIL

    The above should apply to all the XML files in a particular path.

    Thanks in Advance

    Go to Customize > Search tab, and check “Regular Expressions Can Match New Line Characters”, and set “Additional Lines to Search for Regular Expressions” to 10.

    Find:
    (.*?)(]+>){1,20}(.*?)

    Replace with:
    13

    #5775

    prashob12
    Member

    Thanks a lot for replying

    I tried what u told, but the number of Empty elements present in the is many, so if i use the replacment option it deletes one instance at a time, and the number of files with such instances are also many, so it will be time consuming.

    I created a macro to replace all empty elements in at one go:

    document.selection.Find(“”,eeFindNext | eeFindReplaceRegExp);
    document.selection.CharLeft(false,1);
    editor.ExecuteCommandByID(4153);
    document.selection.Find(“”,eeFindNext | eeFindReplaceRegExp);
    document.selection.Replace(“(]+>){1,20}”,””,eeFindNext | eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.selection.Replace(“”,””,eeFindNext | eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.selection.CharRight(false,1);

    But i dont know how to make it run on all the files.
    There are 1000’s of such files.

    Thanks in Advance!!

    #5776

    Yutaka Emura
    Keymaster

    prashob12 wrote:
    Thanks a lot for replying

    I tried what u told, but the number of Empty elements present in the is many, so if i use the replacment option it deletes one instance at a time, and the number of files with such instances are also many, so it will be time consuming.

    I created a macro to replace all empty elements in at one go:

    document.selection.Find(“”,eeFindNext | eeFindReplaceRegExp);
    document.selection.CharLeft(false,1);
    editor.ExecuteCommandByID(4153);
    document.selection.Find(“”,eeFindNext | eeFindReplaceRegExp);
    document.selection.Replace(“(]+>){1,20}”,””,eeFindNext | eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.selection.Replace(“”,””,eeFindNext | eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.selection.CharRight(false,1);

    But i dont know how to make it run on all the files.
    There are 1000’s of such files.

    Thanks in Advance!!

    If you have so many files, how about ReplaceInFiles Method (Editor object)?

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

You must be logged in to reply to this topic.