Here is a Regex I have been trying to make work:
(?:"[^"]*"[^"]*)*?\"{1}([^"]*?([']{1,})[^"]*?)\"
It is probably not the most clean nor the most effective way to achieve what I want to do, but I'm almost there, I think.
My goal is to match any single quote (') that's being quoted between double-quotes ("), so there needs to be an odd amount of double quotes in front of it. I know that for now it only matches the first group of single quotes, that's fine. I will eventually use this regex to replace the first occurence then iterate and use it again to replace the others as long as there are some.
Here are a few examples:
- " This is a random sentence ' with a quote, the quote should match"
- " There is no quote here thats the problem" Anything here should not match but now it does: ' .
- " Some text " some more text " this is a quote : ' that should match"
- " When there is a quote (') here, the other one does not work : " ' and that's perfect " even if you remove the first one this : " (') " will make it work because of the greedy ( I think ) but ifyou remove those between parenthesis, the other one is matching as of now, which I do not want to happen.
- Another example would be this one : The following should not work, but it does "This is being quoted" not this: (') " and this is also being quoted "
Note that I really do not consider myself an expert, a few days ago I knew almost nothing except the classic [a-zA-Z0-9]... Any help is welcome, I may have overlooked something basic.
I have been working it here: https://regex101.com/r/aE7iB8/1