Hello! The task is to split the string '156.75m ^ 2' into an array through a regular partition. My code
var reg = /(\d+)(\.)?(\d+)?(m)(\^)(2)/, str = '156.75m^2', mas = str.split(reg); Everything works well, but because the first and last element of the array is an empty string!
["", "156", ".", "75", "m", "^", "2", ""] Why is this happening and how to fix it? Thanks to all!
Array.from('156.75m^2'.match(/(\d+)(\.)?(\d+)?(m)(\^)(2)/)).slice(1)? - user207618