I use regex to query all square brackets in string by this command:
var sizecolor = textvalue.match(/[^[\]]+(?=])/g);
I want to get a square bracket in object above if it contain "SPrice";
Example: I have string like this:
"I have two square brackets are `[Apple = Red, Cool, Sweet]` and `[Check+SPrice = Cheap, Expensive, Comfortable]`"
How can I returns this [Check+SPrice = Cheap, Expensive, Comfortable] because it contains SPrice
Thanks.
indexOfSprice. Then iterate backwards, until you get the first square bracket, likewise for the last and then cut the string at those indexes?/\[([^[\]]*SPrice[^[\]]*)]/.exec(s)[0](or[1], not sure what you need)