bulk remove row tag



  • Hi, how can i remove a lot rows with this tag?

    <category domain=“post_tag” … </category>

    from a file xml

    what’s the syntax for variable texts? into search box

    Thank you



  • Hello Jake1191,

    You don’t tell us, in your post, if you prefer :

    • (A) Remove all lines containing, exactly, the string <category domain="post_tag"......</category>

    • (B) Remove the string ^<category domain="post_tag"......</category> from all the lines, containing that string

    • (C) Remove ANY line, containing the string <category domain="post_tag"......</category>, as the line, below :

      Some possible text BEFORE <category domain=“post_tag” …</category> Some possible text AFTER


    Anyway, there’s a solution, with a search regular expression, for each of them :-) Note that, for any of them, the replacement zone must be EMPTY!

    So :

    For case (A), use the search regex (?-is)^<category domain="post_tag".+</category>\R

    For case (B), use the search regex (?-is)<category domain="post_tag".+</category>

    For case (C), use the search regex (?-is)^.*<category domain="post_tag".+</category>.*\R?


    NOTES :

    • Of course, the Regular expression search mode must have been set, previously

    • These 3 regexes begin with the in-line modifiers (?-is) which ensures you that the search is done, in a sensitive way and that the dot . meta-character will match standard characters, only !

    • As usual, the \R syntax is a shortened form for matching any kind of EOL characters ( \r\n or \n or \r )

    • In the first case, the string <category domain="post_tag" … </category> is bounded to beginning of line ^ and to its EOL characters, which have to be taken in account, to delete the complete line

    • In the third case, the string <category domain="post_tag" … </category> is preceded, from beginning of line, by any range, even null, of standard characters and followed by any range, too, even null, of standard characters, then generally followed by its EOL characters,

    • The ?, after \R means 0 or 1 time the EOL character(s) , just in case the very last line which would end, without any EOL character !

    • In all cases, the search match is removed, because there’s NO replacement regex !

    Best Regards,

    guy038



  • hi,
    i must remove all the rows where there is the category’s tag.
    Because there are thousands of lines style:
    <category domain=“post_tag” nicename=“ambiente”><![CDATA[Ambiente]]></category>
    but the “domain” must be “post_tag” , there are other values for “domain” that don’t must be removed.

    ps: I apologize for my english



  • Hi, Jake1191,

    From what you said, I think that my solution (C) does exactly what you would like to !

    Indeed, any line, which contains the domain attribute, with a value different from the string post_tag, will NOT be removed :-)

    Cheers,

    guy038


Log in to reply