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

  • Home
  • SEARCH
  • 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 910569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:03:58+00:00 2026-05-15T17:03:58+00:00

I need a simple markup language to store different parts of a string on

  • 0

I need a simple markup language to store different parts of a string on a TEXT field, and then extract those parts.
So basically I want some kind of simple XML. Storing those in the table field is easy, but extracting them… is other matter.
I managed to do so using a simple regex done for regular HTML:

|<[^>]+>(.*)</[^>]+>|U

But in order to re-compose the original array (and use the markup more generally) I need also to know the tag names. And that regex does’t do that.

Examples:

Input text:

<user_input>Hello! my name is Williams</user_input>

The preg_match_all() function using the above regex returns:

array
  0 => 
    array
      0 => string '<user_input>Hello! my name is Williams</user_input>' (length=34)

  1 => 
    array
      0 => string 'Hello! my name is Williams' (length=34)

I need it to return the “user_input” name of the tag. Yes, I know, I suck on regex. Yes, I know “use a XML parser”, but that is too big for what I’am doing.

  • 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-05-15T17:03:59+00:00Added an answer on May 15, 2026 at 5:03 pm

    Just use a capturing group like you did with the content:

    |<([^>]+)>([^<]*)</\1>|
    

    As an added bonus, you can use the captured name to make sure the closing tag has the same name.

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

Sidebar

Related Questions

I am trying to make a simple markup language, and I need my Cocoa
I need a simple way to monitor multiple text log files distributed over a
I need a simple table with a user name and password field in MySQL.
I'm looking for a standard markup language to transmit addresses (locations). I really need
I created a simple markup such as this. <html> <head> <head> <body> <input type=text
I've got a simple function that converts plain text into a wiki markup. But
How do I create unique key value in PHP? I need simple unique keys
I need a simple app to edit database tables. Are there any code generators
I need a simple window with three input boxes and three labels (login name,
I need a simple SQL to accomplish the below: Problem: When a petrol bunk

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.