Friday, 9 August 2013

How to split the substring without empty cells?

How to split the substring without empty cells?

Example:
"div#qwe.%class-first.class-two".split(/([#\.%])/)
["div", "#", "qwe", ".", "", "%", "class-first", ".", "class-two"]
Cell 4 is empty. How do I get rid of this by using regex?

No comments:

Post a Comment