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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:10:59+00:00 2026-06-04T11:10:59+00:00

I have a document with the following format: <scheme attr1=lorem attr2=ipsum global-test=text goes here

  • 0

I have a document with the following format:

<scheme attr1="lorem" attr2="ipsum" global-test="text goes here" global-attr2="second text goes here">
</scheme>

I want to use a regular expression to extract all the attributes that match global-(.*).
It can also only match on the “scheme” element, so using a simple regular expression like (global-([^=]*)="([^"]*)")+ is not an option. I tried the following regular expression:

<scheme.*([\s]+global-([^=]*)="([^"]*)")+

But this will only match on “global-attr2”, and will see the other global attributes as part of the .* selector. Making the * selector on .* lazy also doesn’t seem to help.

And I know that getting data from an XML document with regular expressions isn’t a good practice, but this script is for a preprocessor. It modifies the XML before parsing it.

  • 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-04T11:11:01+00:00Added an answer on June 4, 2026 at 11:11 am

    A preg_match_all will match everything and store everything as well. So first match against “<scheme”, and if it matches, then run preg_match_all Match against something like

    /global-(.*?)=(\w+)/
    

    and then extract from matches[0], matches[1], etc.

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

Sidebar

Related Questions

I have the following in an XLST document <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:fo=http://www.w3.org/1999/XSL/Format xmlns:str=http://xsltsl.org/string xmlns:dt=http://xsltsl.org/date-time
I have an XML document which contains nodes like following:- <a class=custom>test</a> <a class=xyz></a>
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
I have a Html document of the following format. <p>&nbsp;&nbsp;&nbsp;1. Content of the paragraph
I have a xml document on the following format and want to transform it
I have an xml document with the following format: <response username=123 customerName=CustomerName siteName=SiteName customerID=123
I have an xml document in the following format. <?xml version=1.0 encoding=UTF-8 ?> <Rows>
I have an xml file with the following format <someXML> <a> <b></b> <b test='someValue'></b>
I have the following chart in column format which works well: $(document).ready(function() { get_data();
I have a document that has the following format: <Root> <A /> <C />

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.