I want to match all the instances of filter[ … ] but excluding the ones that have a % char in them:
filter[first_name%0]=Tim&filter[first_name]=Tom&filter[first_name]=Bob
The /filter\[.*?\]/i gets all of the instances but how do I exclude the one with % in it?
>Solution :
You can use
filter\[[^\][%]*]
See the regex demo
Details
filter\[– afilter[string[^\][%]*– zero or more (*) chars that are not equal to],[and%]– a literal]char.