-1

If I have a list of file names in an XML and want to remove all instances where the file name doesn't have a file extension, how can I do this using regular expressions? I need to do the replace in TextWrangler and have no other option unfortunately.

For example, if I have such a list in an XML as:

<name>AAA_A026C032_150522_R4RO.mov</name>

<name>BBB_A016D032_150809_R4RO.aiff</name>

<name>CCC_A026C038_151010_R4RO</name>

<name>DDGS_A006C132_150409_R4RO.mp3</name>

<name>EFFD_B026C001_150607_R4RO</name>

<name>FGHG_A026C032_141215_R4RO.cine</name>

Have can the files without the file extension be targeted using regular expressions? I would like to replace these (clear them) in the output document.

Thanks in advance, Matt

  • What defines a file extension? What if my file name is "AAA.BBB_CCC_DDD_EEE_FFF"? It has a dot in it, so does it have an extension? – qJake Oct 15 '15 at 19:22
  • I guess in this case the file extension would be classified as a alphanumeric set of characters after the . before the . File extensions of media files do not contain underscores, hyphens or any other symbols and it is those files that are contained in the XML. – matttickner Oct 15 '15 at 19:39

1 Answers1

0
'(?!>\w+\.[a-zA-Z0-9]+)>(\w+)'

this pattern gets the name of the files without extensions as its first capturing group. I dont know how to use TextWrangler but I assume that with filename string, you can probably figure it out?

R Nar
  • 5,465
  • 1
  • 16
  • 32