Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 294927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:24:42+00:00 2026-05-12T06:24:42+00:00

I try to parse articles from wikipedia. I use the *page-articles.xml file, where they

  • 0

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

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:24:42+00:00Added an answer on May 12, 2026 at 6:24 am

    \[\[(.*?\]\] would do it.

    The key is the .*? which means get any characters but as few a possible.

    EDIT

    For nested tags one approach would be:

    \[\[(?<text>(?>\[\[(?<Level>)|\]\](?<-Level>)|(?! \[\[ | \]\] ).)+(?(Level)(?!)))\]\]
    

    This ensures that the [[ and ]] match across the text as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse an xml file from a website. Let's say the website
I have the following Python code: import xml.dom.minidom import xml.parsers.expat try: domTree = ml.dom.minidom.parse(myXMLFileName)
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
My code must parse Vcard 2.1 format. I am using vpim(there are no other
I have a file in JSON format with record for individual users. Some of
I try to write a simple Markdown parser in JavaScript. Therefore I want to
I'm using IPAddress.TryParse() to parse IP addresses. However, it's a little too permissive (parsing
I want to use the DateTime.TryParse method to get the datetime value of a
try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... }
How do I make dojo parse dates without the slashes, while still respecting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.