Hey together,
i have this string: " <xhtml super code=“www.super.de”:pre-wrap;>{scope content}"
Now i want to remove everything before the {
How can I do this?
I tried using split but i did not work.
Please help me.
Greetz
Hey together,
i have this string: " <xhtml super code=“www.super.de”:pre-wrap;>{scope content}"
Now i want to remove everything before the {
How can I do this?
I tried using split but i did not work.
Please help me.
Greetz
You could use a regular expression to grab everything inside the {}
:
def grab_content(str)
str.gsub(/\{(.*?)\}/, '\1')
end
Edit: This will only replace the {}
. If the string contains anything before {
or after }
, that will still be present in the string.
If you want to just find the stuff inside, you can use #scan
instead.
"this{scope content}that".scan(/\{(.*?)\}/)[0][0] # => "scope content"