If I am given a sample string like the one given below and I want to extract ids and code values
demo = '{"orders":[{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9}],"errors":[{"code":3,"message":"[PHP Warning #2] count(): Parameter must be an array or an object that implements Countable (153)"}]}'
using regex
r'"id":([0-9]+)'
gets me the ids i.e 1,2,3,4 etc but I am having trouble getting the value inside the key code
in one regex expression.
I searched for AND operators and stumbled upon
Regular Expressions: Is there an AND operator?
but this approach doesn't help me.