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 8084367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:46:29+00:00 2026-06-05T17:46:29+00:00

I have a database with a lot of old phpBB data that contains posts

  • 0

I have a database with a lot of old phpBB data that contains posts with text like:

[b:522f1e2c15]bold[/b:522f1e2c15]
[i:522f1e2c15]italic[/i:522f1e2c15]
[u:522f1e2c15]underline[/u:522f1e2c15]
[img:522f1e2c15]http://www.mysite.com/myimage.jpg[/img:522f1e2c15]
[quote:522f1e2c15="Mr Smith"]quoted text by Mr Smith[/quote:522f1e2c15]
[quote="Mr Smith"]quoted text by Mr Smith[/quote]

I am migrating this data to a new system, and these tags all need to be manipulated when I come to render them, so they become:

<b>bold</b>
<i>italic</i>
<u>underline</u>
<img src="http://www.mysite.com/myimage.jpg" />
<div><h4>Posted by Mr Smith</h4>quoted text by Mr Smith
<div><h4>Posted by Mr Smith</h4>quoted text by Mr Smith

In most cases, the ‘id’ that appears within the original phpBB tags are the same ‘per post’, so a post might look like the following (with all tags containing the id ‘522f1e2c15’):

This is [b:522f1e2c15]bold[/b:522f1e2c15] and this is [i:522f1e2c15]italic[/i:522f1e2c15].

However, I do also need to cater for that id being different from one tag to the next, within the same post, i.e.

This is [b:123f1e2c15]bold[/b:123f1e2c15] and this is [i:522f1e2c15]italic[/i:522f1e2c15].

I also need to be able to handle nested instances of these tags, for example, bold tagged text with some italic tagged text inside, i.e.

This is [b:522f1e2c15]bold and [i:522f1e2c15]this is bold italic[/i:522f1e2c15][/b:522f1e2c15].

I originally posted a similar question on here specifically to handle the ‘quote’ instance of the above, which was answered with what appeared to be a working solution, but with further testing, I’ve noticed that if the id contained within a tag is used in another tag in the same post (i.e. the example I posted above), then it breaks.

So essentially I need a regular expression solution that handles all of the above.

  • 1 1 Answer
  • 0 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-06-05T17:46:30+00:00Added an answer on June 5, 2026 at 5:46 pm

    The nested tags bit is the difficult part to do in Regex, but the .NET regex engine provides all the tools required to handle them and the ID matching. You can apply a regex with balanced groups to solve the task.

    That said, for this kind of data I’d rather implement a true parser, for instance by using a toolset such as the GOLD Parser System or ANTLR.

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

Sidebar

Related Questions

I have a database with a lot of old phpBB data that contains posts
I have an XMLHttpRequest that insert a lot of data to a MySQL database
A have a database on MS-SQL Server 2008 that is growing a lot, year
I have inherited a database that has a lot of cursors in it, and
I have a TSQL script that does a lot of database structure adjustments but
The problem I have is that I have an old database where there typically
I have a SQL Server that holds a lot of data. An application, running
I have a database with a lot of tables, and I want to rename
We have a large database containing a lot of stored procedures. Now we are
I am new to LINQ to SQL, but have done a lot of database

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.