I have a string like:
"super exemple of string key : text I want to keep - end of my string"
I want to just keep the string which is between "key : "
and " - "
. How can I do that? Must I use a Regex or can I do it in another way?
I have a string like:
"super exemple of string key : text I want to keep - end of my string"
I want to just keep the string which is between "key : "
and " - "
. How can I do that? Must I use a Regex or can I do it in another way?
Since the
:
and the-
are unique you could use:I think this works:
Depending on how robust/flexible you want your implementation to be, this can actually be a bit tricky. Here's the implementation I use:
or with just string operations