How i can split string in js for result:
result = ["post_address", "location", "area"]
This is problem? Need help with re
let re = ???
let arr = "post_address[location][area]".split(re)
How i can split string in js for result:
result = ["post_address", "location", "area"]
This is problem? Need help with re
let re = ???
let arr = "post_address[location][area]".split(re)
Use Lodash:
const str = "post_address[location][area]";
const output = _.compact(_.split(str, /\[|\]/));
console.log(output);
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>