Let's say I have some text that has the pattern as shown by the four lines of text below:
foo.bar.gar
foo.bar.gar.har.mar.tar.dar.zar.daddy.whatever.mummy.whateverelse
foo.hoo.scoobydoobydoo.yay
sunday.monday
The only two things known about the pattern are that:
- There will be at least 1 pair of words separated by a dot (period); and
- The text will always end in a character that is not a dot (period).
What I Want
I want to get just the last two fragments of text and the period between them. For e.g. if the text were:
foo.bar.gar
I want to get the fragment:
bar.gar
I'd been trying for the last couple of hours but then I gave up. Help will be appreciated.