I'm not familiar with regex, and it would be great to have some help.
I have a string:
string = '{"shippingStyle": "notProvided", "id": "3b0ec9d4-52ff-4ca7-8e66-bfd67f31662c", "_version": 19, "total": 50857, "shippingPrice": 1114}'
and I would like to remove "_version": 19, in order to have
string = '{"shippingStyle": "notProvided", "id": "3b0ec9d4-52ff-4ca7-8e66-bfd67f31662c", "total": 50857, "shippingPrice": 1114}'
I've tried it with:
string = re.sub(r'"_version\S+ ', r'', string)
Any suggestions?
source https://stackoverflow.com/questions/69329198/remove-version-19-from-a-string-using-regex
Comments
Post a Comment