I have a RegEx that should find all alphanumeric characters or texts between square brackets like the example in the link above. Those texts are in fact links with descriptions (for example [[Toto|there's a link here]]
is a link to the page Toto
)
But the problem is that I could have other text between square brackets and so like you can see in the link it doesn't recognize the brackets in the end (]]
).
There's also an another important patern in those links there's pipes in it (|
) that separate my texts in two or three parts. In the case there's two parts in it I only want to get the text on the left and in the case there's three parts I want to the text on the right.
Example:
[[File:Euclid flowchart 1.png|vignette|[[Flowchart]] of an algorithm ([[Euclid's algorithm]]).]]
I only want [[Flowchart]] of an algorithm ([[Euclid's algorithm]]).
part (this is a png with a description below and in this description there's other links)
[[Babylone|Babyloniens]]
I want Babylone
In the first example there's other links inside but I can easily extract them with my first regex or a recursion.
You can see an example of my code here