Hi folks,
I try to parse articles from wikipedia. I use the *page-articles.xml file, where they backup all their articles in a wikicode-format. To strip the format and get the raw text, I try to use Regular Expressions, but I am not very used to it. I use C# as programming language. I tried a bit around with Expresso, a designer for Regular Expressions, but I am at the end of my wits. Here is what I want to achieve:
The text can contain the following structures: [[TextN]] or [[Text1|TextN]] or [[Text1|Text2|...|TextN]]
the [[ .... ]] pattern can appear within the Texti aswell. I want to replace these structure with TextN
For identifing the structures withhin the text I tried the following RegEx:
\[\[ ( .* \|?)* \]\]
Expresso seems to run and endless loop with this one. After 5 minutes for a relative small text, I canceled the Test Run.
Then I tried something more simple, I want to capture anything between the brackets:
\[\[ .* \]\]
but when I have a line like:
[[Word1]] text inbetween [[Word2]]
the expression returns the whole line, not
[[Word1]]
[[Word2]]
Any tips from Regex-Experts here to solve the problem?
Thanks in advance, Frank