Suppose I have JSON strings like this:
[
{
"key1": "value",
"key2": {
"word1.word2.word3.word4.interestingPart": {
"key1": "value",
"key2": "value"
}
},
"key3": "value"
},
{
"key1": "value",
"key2": {
"word1.word2.word3.word4.word5.word6.thisIsAlsoAnInterestingPart": {
"key1": "value",
"key2": "value"
}
},
"key3": "value"
}
]
How do I use regex to match that last "interesting part" in a key? I can expect that the key always starts the same way (word1, word2, word3, word4). However, there might be something that I don't want to be included in the match that differs from file to file (word5, word6).
This is what I have come up so far:
.+(\..+)+(?=")
https://regex101.com/r/BjOcfl/1
It matches the last part but also includes one preceding period. I'd like it to match just the word without anything else.
UPDATE: I had used Python regex rules which apparently do not work in my case. Using Python, my regex matches the last part with one additional period but with JavaScript rules it matches the whole key.