I have a problem to create a regular expression. I have a string like this (a simple json response froma webserver):
{
"key1":valueInt1,
"key2":valueInt2,
[...]
"specialKey":"",
"subtitle":"Every kind of character, like char, num or punct",
"key3":"Useful line",
}
What I want is to delete the keys “specialKey” and its value and “subtitle” with its value. Both of them can be empty (like specialKey in my example).
I have tried something like that:
(\"subtitle\"\:\")([:punct:]*[:space:]*[:word:]*)*(\",)
Without success. The error is the part ([:punct:][:space:][:word:]) to match my random sentence.
Thanks for your help!
Character classes are usually only used within bracket expressions. If you change what you have into:
It should work.