I'm trying to match markdown tags with recursive.
Input Syntax
(TYPE: VALUE ATTR_KEY: ATTR_VALUE)
Note that syntax should be starts with: [a-z0-9_-]+:
Sample Inputs:
(image: sky.jpg)
(image: sky.jpg caption: Sky (Issue This) View)
(link: https://stackoverflow.com text: Stack Overflow)
(link: https://stackoverflow.com text: Stack Overflow rel=nofollow)
(video: http://www.youtube.com/watch?v=49Kh1mS4Fhs)
Currently using following regex:
(?=[^\]])\([a-z0-9_-]+:.*?\)
But issue coming from here, because match with:
(image: sky.jpg caption: Sky (Issue This)
Expected match:
(image: sky.jpg caption: Sky (Issue This) View)
If parentheses are used again in parentheses, it does not match exactly.
I tried following recursive patterns and works but i need to restrict starts with characters.
(?s)\((?:[^()]+|(?R))*+\)
\((?:[^)(]+|(?R))*+\)