extract string using ruby regex -


I have a string

  "Fashion Project - Institute of Fashion Technology Project and Science " 

I need to remove the string as the name of the project and its description so that it can return an array. [0] = "Fashion Project" array [1] = "Project of Fashion Technology and Science"

I With the split method, Array [1] returned the "Fashion Project", I did it

  "Fashion Project - Fashion-Technology and Project of Science - Institute" .split ( '-')  

You can also try

  2.1.2: 007> S = "The Fashion Project - Project of Fashion-Technologies and Science Institute" = & gt; "Fashion Project - Project of Fashion-Technologies and Science Institute" 2.1.2: 008 & gt; S.split (/ \s [- \ b] \ s /) = & gt; ["Fashion Project", "Project of Fashion-Technology and Science Institute"] 2.1.2: 00 9 & gt;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -