How to split a string that contains a set in Ruby?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







4















I am new to the forum. I am currently trying to take this string:



65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010


and split it in order to get this:



65101km
Sedan
Manual
18131A
FWD
Used
5.5L/100km
Toyota
camry
SE
{AC, Heated Seats, Heated Mirrors, Keyless Entry}
2010


I have the following regex:



data_from_file.split(/[{},]+/)


But I am having a hard time keeping the set.



Any ideas?










share|improve this question























  • Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

    – vovan
    Nov 16 '18 at 15:57











  • In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

    – Cary Swoveland
    Nov 17 '18 at 20:23




















4















I am new to the forum. I am currently trying to take this string:



65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010


and split it in order to get this:



65101km
Sedan
Manual
18131A
FWD
Used
5.5L/100km
Toyota
camry
SE
{AC, Heated Seats, Heated Mirrors, Keyless Entry}
2010


I have the following regex:



data_from_file.split(/[{},]+/)


But I am having a hard time keeping the set.



Any ideas?










share|improve this question























  • Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

    – vovan
    Nov 16 '18 at 15:57











  • In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

    – Cary Swoveland
    Nov 17 '18 at 20:23
















4












4








4


1






I am new to the forum. I am currently trying to take this string:



65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010


and split it in order to get this:



65101km
Sedan
Manual
18131A
FWD
Used
5.5L/100km
Toyota
camry
SE
{AC, Heated Seats, Heated Mirrors, Keyless Entry}
2010


I have the following regex:



data_from_file.split(/[{},]+/)


But I am having a hard time keeping the set.



Any ideas?










share|improve this question














I am new to the forum. I am currently trying to take this string:



65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010


and split it in order to get this:



65101km
Sedan
Manual
18131A
FWD
Used
5.5L/100km
Toyota
camry
SE
{AC, Heated Seats, Heated Mirrors, Keyless Entry}
2010


I have the following regex:



data_from_file.split(/[{},]+/)


But I am having a hard time keeping the set.



Any ideas?







ruby regex split






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 15:13









Andres V.Andres V.

234




234













  • Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

    – vovan
    Nov 16 '18 at 15:57











  • In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

    – Cary Swoveland
    Nov 17 '18 at 20:23





















  • Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

    – vovan
    Nov 16 '18 at 15:57











  • In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

    – Cary Swoveland
    Nov 17 '18 at 20:23



















Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

– vovan
Nov 16 '18 at 15:57





Maybe this answer will be useful: stackoverflow.com/questions/42475528/… will hel

– vovan
Nov 16 '18 at 15:57













In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

– Cary Swoveland
Nov 17 '18 at 20:23







In future, please ensure all values in examples are valid Ruby objects. Here that would mean putting the string in quotes and displaying the output as an array of strings (["65101km", "Sedan",..., "2010"]). Here your intent is clear, but if your array had been an input every reader who wanted to use it in code would have to convert it to a valid object. Also, it's helpful to assign a variable to all inputs (here just one) in your example (str = "65101km,..."), so readers can refer to those variables in answers and comments. In case you didn't know, you can upvote answers you checkmark.

– Cary Swoveland
Nov 17 '18 at 20:23














2 Answers
2






active

oldest

votes


















1














You may use



s.scan(/(?:{[^{}]*}|[^,])+/)


See the Rubular and Regex.101 demos.



Pattern details





  • (?: - start of a non-capturing group:



    • {[^{}]*} - {, 0 or more chars other than { and } and then }




  • | - or



    • [^,] - any 1 char other than ,




  • )+ - repeated 1 or more times.






share|improve this answer



















  • 1





    Simple and clean!

    – Cary Swoveland
    Nov 17 '18 at 3:05






  • 1





    This is really nice! Thank you so much

    – Andres V.
    Nov 17 '18 at 17:39



















1














str = "65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010"




r = /
(?<=A|,) # match the beginning of the string or a comma in a positive lookbehind
(?: # begin a non-capture group
{.*?} # match an open brace followed by any number of characters,
# lazily, followed by a closed brace
| # or
.*? # match any number of characters, lazily
) # close non-capture group
(?=,|z) # match a comma or the end of the string in a positive lookahead
/x # free-spacing regex definition mode

str.scan r
#=> ["65101km", "Sedan", "Manual", "18131A", "FWD", "Used", "5.5L/100km", "Toyota",
# "camry", "SE", "{AC,Heated Seats, Heated Mirrors, Keyless Entry}", "2010"]


Two notes follow. I'll illustrate these with a simpler string.



str = "65101km,Sedan,{AC,Heated Seats},2010"


{.*?} must precede .*? in (?:{.*?}|.*?)



If



r = /(?<=A|,)(?:.*?|{.*?})(?=,|z)/


then



str.scan r
#=> ["65101km", "Sedan", "{AC", "Heated Seats}", "2010"]


The matches .* must be lazy (aka non-greedy)



If



r = /(?<=A|,)(?:{.*?}|.*)(?=,|z)/


then



str.scan r
#=> ["65101km,Sedan,{AC,Heated Seats},2010"]


If



r = /(?<=A|,)(?:{.*}|.*?)(?=,|z)/


then



"65101km,Sedan,{AC,Heated Seats},2010,{starter motor, pneumatic tires}".scan r
#=> ["65101km", "Sedan", "{AC,Heated Seats},2010,{starter motor, pneumatic tires}"]





share|improve this answer


























  • Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

    – Andres V.
    Nov 16 '18 at 16:03






  • 1





    What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

    – Cary Swoveland
    Nov 16 '18 at 16:21






  • 1





    At Regex101, 2010 is matched.

    – Wiktor Stribiżew
    Nov 16 '18 at 16:53











  • just tried it out its perfect! Thanks guys. I had put a space like Gary said.

    – Andres V.
    Nov 17 '18 at 17:37












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53340560%2fhow-to-split-a-string-that-contains-a-set-in-ruby%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You may use



s.scan(/(?:{[^{}]*}|[^,])+/)


See the Rubular and Regex.101 demos.



Pattern details





  • (?: - start of a non-capturing group:



    • {[^{}]*} - {, 0 or more chars other than { and } and then }




  • | - or



    • [^,] - any 1 char other than ,




  • )+ - repeated 1 or more times.






share|improve this answer



















  • 1





    Simple and clean!

    – Cary Swoveland
    Nov 17 '18 at 3:05






  • 1





    This is really nice! Thank you so much

    – Andres V.
    Nov 17 '18 at 17:39
















1














You may use



s.scan(/(?:{[^{}]*}|[^,])+/)


See the Rubular and Regex.101 demos.



Pattern details





  • (?: - start of a non-capturing group:



    • {[^{}]*} - {, 0 or more chars other than { and } and then }




  • | - or



    • [^,] - any 1 char other than ,




  • )+ - repeated 1 or more times.






share|improve this answer



















  • 1





    Simple and clean!

    – Cary Swoveland
    Nov 17 '18 at 3:05






  • 1





    This is really nice! Thank you so much

    – Andres V.
    Nov 17 '18 at 17:39














1












1








1







You may use



s.scan(/(?:{[^{}]*}|[^,])+/)


See the Rubular and Regex.101 demos.



Pattern details





  • (?: - start of a non-capturing group:



    • {[^{}]*} - {, 0 or more chars other than { and } and then }




  • | - or



    • [^,] - any 1 char other than ,




  • )+ - repeated 1 or more times.






share|improve this answer













You may use



s.scan(/(?:{[^{}]*}|[^,])+/)


See the Rubular and Regex.101 demos.



Pattern details





  • (?: - start of a non-capturing group:



    • {[^{}]*} - {, 0 or more chars other than { and } and then }




  • | - or



    • [^,] - any 1 char other than ,




  • )+ - repeated 1 or more times.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 16:55









Wiktor StribiżewWiktor Stribiżew

330k16149229




330k16149229








  • 1





    Simple and clean!

    – Cary Swoveland
    Nov 17 '18 at 3:05






  • 1





    This is really nice! Thank you so much

    – Andres V.
    Nov 17 '18 at 17:39














  • 1





    Simple and clean!

    – Cary Swoveland
    Nov 17 '18 at 3:05






  • 1





    This is really nice! Thank you so much

    – Andres V.
    Nov 17 '18 at 17:39








1




1





Simple and clean!

– Cary Swoveland
Nov 17 '18 at 3:05





Simple and clean!

– Cary Swoveland
Nov 17 '18 at 3:05




1




1





This is really nice! Thank you so much

– Andres V.
Nov 17 '18 at 17:39





This is really nice! Thank you so much

– Andres V.
Nov 17 '18 at 17:39













1














str = "65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010"




r = /
(?<=A|,) # match the beginning of the string or a comma in a positive lookbehind
(?: # begin a non-capture group
{.*?} # match an open brace followed by any number of characters,
# lazily, followed by a closed brace
| # or
.*? # match any number of characters, lazily
) # close non-capture group
(?=,|z) # match a comma or the end of the string in a positive lookahead
/x # free-spacing regex definition mode

str.scan r
#=> ["65101km", "Sedan", "Manual", "18131A", "FWD", "Used", "5.5L/100km", "Toyota",
# "camry", "SE", "{AC,Heated Seats, Heated Mirrors, Keyless Entry}", "2010"]


Two notes follow. I'll illustrate these with a simpler string.



str = "65101km,Sedan,{AC,Heated Seats},2010"


{.*?} must precede .*? in (?:{.*?}|.*?)



If



r = /(?<=A|,)(?:.*?|{.*?})(?=,|z)/


then



str.scan r
#=> ["65101km", "Sedan", "{AC", "Heated Seats}", "2010"]


The matches .* must be lazy (aka non-greedy)



If



r = /(?<=A|,)(?:{.*?}|.*)(?=,|z)/


then



str.scan r
#=> ["65101km,Sedan,{AC,Heated Seats},2010"]


If



r = /(?<=A|,)(?:{.*}|.*?)(?=,|z)/


then



"65101km,Sedan,{AC,Heated Seats},2010,{starter motor, pneumatic tires}".scan r
#=> ["65101km", "Sedan", "{AC,Heated Seats},2010,{starter motor, pneumatic tires}"]





share|improve this answer


























  • Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

    – Andres V.
    Nov 16 '18 at 16:03






  • 1





    What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

    – Cary Swoveland
    Nov 16 '18 at 16:21






  • 1





    At Regex101, 2010 is matched.

    – Wiktor Stribiżew
    Nov 16 '18 at 16:53











  • just tried it out its perfect! Thanks guys. I had put a space like Gary said.

    – Andres V.
    Nov 17 '18 at 17:37
















1














str = "65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010"




r = /
(?<=A|,) # match the beginning of the string or a comma in a positive lookbehind
(?: # begin a non-capture group
{.*?} # match an open brace followed by any number of characters,
# lazily, followed by a closed brace
| # or
.*? # match any number of characters, lazily
) # close non-capture group
(?=,|z) # match a comma or the end of the string in a positive lookahead
/x # free-spacing regex definition mode

str.scan r
#=> ["65101km", "Sedan", "Manual", "18131A", "FWD", "Used", "5.5L/100km", "Toyota",
# "camry", "SE", "{AC,Heated Seats, Heated Mirrors, Keyless Entry}", "2010"]


Two notes follow. I'll illustrate these with a simpler string.



str = "65101km,Sedan,{AC,Heated Seats},2010"


{.*?} must precede .*? in (?:{.*?}|.*?)



If



r = /(?<=A|,)(?:.*?|{.*?})(?=,|z)/


then



str.scan r
#=> ["65101km", "Sedan", "{AC", "Heated Seats}", "2010"]


The matches .* must be lazy (aka non-greedy)



If



r = /(?<=A|,)(?:{.*?}|.*)(?=,|z)/


then



str.scan r
#=> ["65101km,Sedan,{AC,Heated Seats},2010"]


If



r = /(?<=A|,)(?:{.*}|.*?)(?=,|z)/


then



"65101km,Sedan,{AC,Heated Seats},2010,{starter motor, pneumatic tires}".scan r
#=> ["65101km", "Sedan", "{AC,Heated Seats},2010,{starter motor, pneumatic tires}"]





share|improve this answer


























  • Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

    – Andres V.
    Nov 16 '18 at 16:03






  • 1





    What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

    – Cary Swoveland
    Nov 16 '18 at 16:21






  • 1





    At Regex101, 2010 is matched.

    – Wiktor Stribiżew
    Nov 16 '18 at 16:53











  • just tried it out its perfect! Thanks guys. I had put a space like Gary said.

    – Andres V.
    Nov 17 '18 at 17:37














1












1








1







str = "65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010"




r = /
(?<=A|,) # match the beginning of the string or a comma in a positive lookbehind
(?: # begin a non-capture group
{.*?} # match an open brace followed by any number of characters,
# lazily, followed by a closed brace
| # or
.*? # match any number of characters, lazily
) # close non-capture group
(?=,|z) # match a comma or the end of the string in a positive lookahead
/x # free-spacing regex definition mode

str.scan r
#=> ["65101km", "Sedan", "Manual", "18131A", "FWD", "Used", "5.5L/100km", "Toyota",
# "camry", "SE", "{AC,Heated Seats, Heated Mirrors, Keyless Entry}", "2010"]


Two notes follow. I'll illustrate these with a simpler string.



str = "65101km,Sedan,{AC,Heated Seats},2010"


{.*?} must precede .*? in (?:{.*?}|.*?)



If



r = /(?<=A|,)(?:.*?|{.*?})(?=,|z)/


then



str.scan r
#=> ["65101km", "Sedan", "{AC", "Heated Seats}", "2010"]


The matches .* must be lazy (aka non-greedy)



If



r = /(?<=A|,)(?:{.*?}|.*)(?=,|z)/


then



str.scan r
#=> ["65101km,Sedan,{AC,Heated Seats},2010"]


If



r = /(?<=A|,)(?:{.*}|.*?)(?=,|z)/


then



"65101km,Sedan,{AC,Heated Seats},2010,{starter motor, pneumatic tires}".scan r
#=> ["65101km", "Sedan", "{AC,Heated Seats},2010,{starter motor, pneumatic tires}"]





share|improve this answer















str = "65101km,Sedan,Manual,18131A,FWD,Used,5.5L/100km,Toyota,camry,SE,{AC,Heated Seats, Heated Mirrors, Keyless Entry},2010"




r = /
(?<=A|,) # match the beginning of the string or a comma in a positive lookbehind
(?: # begin a non-capture group
{.*?} # match an open brace followed by any number of characters,
# lazily, followed by a closed brace
| # or
.*? # match any number of characters, lazily
) # close non-capture group
(?=,|z) # match a comma or the end of the string in a positive lookahead
/x # free-spacing regex definition mode

str.scan r
#=> ["65101km", "Sedan", "Manual", "18131A", "FWD", "Used", "5.5L/100km", "Toyota",
# "camry", "SE", "{AC,Heated Seats, Heated Mirrors, Keyless Entry}", "2010"]


Two notes follow. I'll illustrate these with a simpler string.



str = "65101km,Sedan,{AC,Heated Seats},2010"


{.*?} must precede .*? in (?:{.*?}|.*?)



If



r = /(?<=A|,)(?:.*?|{.*?})(?=,|z)/


then



str.scan r
#=> ["65101km", "Sedan", "{AC", "Heated Seats}", "2010"]


The matches .* must be lazy (aka non-greedy)



If



r = /(?<=A|,)(?:{.*?}|.*)(?=,|z)/


then



str.scan r
#=> ["65101km,Sedan,{AC,Heated Seats},2010"]


If



r = /(?<=A|,)(?:{.*}|.*?)(?=,|z)/


then



"65101km,Sedan,{AC,Heated Seats},2010,{starter motor, pneumatic tires}".scan r
#=> ["65101km", "Sedan", "{AC,Heated Seats},2010,{starter motor, pneumatic tires}"]






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 16 '18 at 17:50

























answered Nov 16 '18 at 15:55









Cary SwovelandCary Swoveland

71.2k54167




71.2k54167













  • Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

    – Andres V.
    Nov 16 '18 at 16:03






  • 1





    What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

    – Cary Swoveland
    Nov 16 '18 at 16:21






  • 1





    At Regex101, 2010 is matched.

    – Wiktor Stribiżew
    Nov 16 '18 at 16:53











  • just tried it out its perfect! Thanks guys. I had put a space like Gary said.

    – Andres V.
    Nov 17 '18 at 17:37



















  • Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

    – Andres V.
    Nov 16 '18 at 16:03






  • 1





    What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

    – Cary Swoveland
    Nov 16 '18 at 16:21






  • 1





    At Regex101, 2010 is matched.

    – Wiktor Stribiżew
    Nov 16 '18 at 16:53











  • just tried it out its perfect! Thanks guys. I had put a space like Gary said.

    – Andres V.
    Nov 17 '18 at 17:37

















Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

– Andres V.
Nov 16 '18 at 16:03





Hey Cary, for some reason when I put this on regex101, it doesn't read the 2010 at the end. I thank you for the answer !

– Andres V.
Nov 16 '18 at 16:03




1




1





What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

– Cary Swoveland
Nov 16 '18 at 16:21





What can I say? Ruby matches "2010". Did you perchance test with a string that contains a space between the last comma and "2010"?

– Cary Swoveland
Nov 16 '18 at 16:21




1




1





At Regex101, 2010 is matched.

– Wiktor Stribiżew
Nov 16 '18 at 16:53





At Regex101, 2010 is matched.

– Wiktor Stribiżew
Nov 16 '18 at 16:53













just tried it out its perfect! Thanks guys. I had put a space like Gary said.

– Andres V.
Nov 17 '18 at 17:37





just tried it out its perfect! Thanks guys. I had put a space like Gary said.

– Andres V.
Nov 17 '18 at 17:37


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53340560%2fhow-to-split-a-string-that-contains-a-set-in-ruby%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma