A complicated character extraction in R

I've got a character vector with many elements that look like this:

katimajjutiksaq+{kati:katit/1v}{ma:ma/1vv}{jjuti:jjut/1vn}{ksaq:ksaq/1nn}
tuksiarnirmut+{tuksiar:tuksiaq/1v}{nir:niq/2vn}{mut:mut/tn-dat-s}
mista+{mista:mista/1n}
etc. (where the format consists of a whole Inuktitut word followed by a + followed by any number of curly braced tags in the format: {part of the original word:some letters/a combination of letters, numbers and -dashes}

I would like to extract only the character strings between : and } so each one is its own element.  Using the lines above, it would look like this:

katit/1v
ma/1vv
jjut/1vn
ksaq/1nn
tuksiaq/1v
niq/2vn
etc

I have tried using strsplit and regular expressions but my code is clumsy and long.  Can you suggest a good way?
MarkMcAndrewsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aboo_sCommented:
using php:
function get_string_between($string, $start, $end){
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    $tmp = substr($string,$ini,$len);
    return $tmp;
}

while(get_string_between($fullstring, ":", "}") != "")
{
    $parsed = get_string_between($fullstring, ":", "}");
    str_replace("",":".$tmp."}",$string);
}
    echo $parsed."\r\n";
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aboo_sCommented:
edited version:  (tested!)

$string = "katimajjutiksaq+{kati:katit/1v}{ma:ma/1vv}{jjuti:jjut/1vn}{ksaq:ksaq/1nn}
tuksiarnirmut+{tuksiar:tuksiaq/1v}{nir:niq/2vn}{mut:mut/tn-dat-s}
mista+{mista:mista/1n}";
function get_string_between($string, $start, $end){
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    $tmp = substr($string,$ini,$len);
    return $tmp;
}
//$tmp = get_string_between($string, ":", "}");
//echo $string."</br>";
//echo str_replace(":".$tmp."}","",$string);

while(get_string_between($string, ":", "}") != "")
{
    $parsed = get_string_between($string, ":", "}");
    $string=str_replace(":".$parsed."}","",$string);
    echo $parsed."</br>";
}
0
MarkMcAndrewsAuthor Commented:
Awesome, thanks!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

MarkMcAndrewsAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for MarkMcAndrews's comment #a40781600

for the following reason:

It outputs the desired output.
0
aboo_sCommented:
Awesome, thanks! It outputs the desired output.

And then close the question with no points!!!

OOOOObjection!!
0
MazdajaiCommented:
How is it "outputs the desired output." when you resolved by an EE's solution? Please review rules for closing on your own comment.
0
MarkMcAndrewsAuthor Commented:
Sorry I don't know what I did wrong.  I thought I clicked on "accept solution" for your answer.  Thanks so much - it was a great answer and I really appreciate your help.  Sorry that I mess up somehow.  I hope that I fixed the problem by accepting your solution.  My bad!
0
aboo_sCommented:
Glad to have helped.

Think nothing of it, no harm done ;)
Good luck with your code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.