Strings representing file names with substrings of characters separated by “.” Each string has a varying number of substrings, each of which can be any text, except the last one, which is the file extension. I want to keep only the last substring S1 and the file extension; e.g.:
What I have:
S4.S3.S2.S1.txt
S2.S1.txt
S3.S2.S1.txt
S1.txt
What I want:
S1.txt
S1.txt
S1.txt
S1.txt
where S1
, S2
, S3
, … can be anything (letters, numbers, parens) and different in each line, while the last substring (txt in this example) is always the same. I am trying to construct a REGEX for this and failing miserably. Can anyone suggest a way to do this?