Reputation: 33850
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:
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.
Upvotes: 0
Views: 166
Reputation: 7906
resultString = Regex.Match(subjectString, @"\w*.\w*$", RegexOptions.Multiline).Groups[1].Value;
Upvotes: 2