Here i am having a string "one two $\alpha \beta $ three"
.
What i need is to get the part of string until its second occurrence of a character here it is "$"
or may be group of characters "$$"
.
ie, output should be
"one two $\alpha \beta $"
and
"one two $$\alpha \beta $$"
if the string is "one two $$\alpha \beta $$ three"
.