Remove XML sections where <MediaFileLink> tag does not contain http://



  • In the example below only one of the <MediaFileLink> tags are a good URL. How can I completely delete the two bad ones?

    <MediaFile>
      <MediaFileFormatCode>15</MediaFileFormatCode>
      <ImageResolution>1.3</ImageResolution>
      <MediaFileLinkTypeCode>23</MediaFileLinkTypeCode>
      <MediaFileLink>cm</MediaFileLink>
      <MediaFileDate>cm</MediaFileDate>
    </MediaFile>
    <MediaFile>
      <MediaFileFormatCode>03</MediaFileFormatCode>
      <MediaFileLinkTypeCode>01</MediaFileLinkTypeCode>
      <MediaFileLink>http://images.myfileurl.biz/1234567891822.jpg</MediaFileLink>
    </MediaFile>
    <MediaFile>
      <MediaFileTypeCode>04</MediaFileTypeCode>
      <MediaFileFormatCode>03</MediaFileFormatCode>
      <ImageResolution>96</ImageResolution>
      <MediaFileLinkTypeCode>06</MediaFileLinkTypeCode>
      <MediaFileLink>C:\Folder\sub1\sub2\COMP\sub3\ProprietaryProducts\1234567891822.jpg</MediaFileLink>
      <MediaFileDate>20170727</MediaFileDate>
    </MediaFile>
    

    I used this for blank ones ^\s*<MediaFile>\r\n^\s*<MediaFileLink>.?</MediaFileLink>\r\n^\s</MediaFile>


Log in to reply