Regex Match Quotation Marks

Hello,

I wrote a regex to match some stuff. It’s essentially matching some PHP code. I want to be able to match the quotation marks, but only the pairs.

So, for example, if I have something like:
'"['"]

I want the second ['"] to only match the same one as the first, so:
“A”
‘A’

should match, but not
“A’
'A”
(and ultimately) “Something ‘random’”

Any ideas?

Thanks.

So, along the same lines, I have this regex (in PHP):
“/(get_)?the_block\(\s?'\"['\”]\s?(,\s?'\\\"['\“])?\s?\)/”

It matches basically a function call which looks like:
get_the_block(‘a’,‘b’)

(with ‘b’ being optional).

It’s working for single-quotes, but for some reason it doesn’t with double-quotes. Any idea?