I want to use a regex that matches anything but when it finds a special character stop from matching.] I want to use this pattern \*\s*\[\[.*
and when become this : ]]
it stops matching.
For example it should match * [[anything here]]
or * [[]]
and it should not match the * [[anythng here]] anything ]]
or should not match the * [[]]]]
I want to use this regex in Python for a Wikipedia bot.
\*\s*\[\[.*?\]\]
The ?
after .*
above makes the match reluctant/ungreedy. It will only match up until the first instance of ]]
rather than the last.