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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:58:10+00:00 2026-05-21T13:58:10+00:00

Using PHP Regular Expression I want to extract some value from code <?xml version=1.0

  • 0

Using PHP Regular Expression I want to extract some value from code

<?xml version="1.0" encoding="UTF-8"?>
                <xs:restriction base="xs:string">
                <xs:enumeration value="001">
                    <xs:annotation>
                        <xs:documentation>Accountancy</xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="002">
                    <xs:annotation>
                        <xs:documentation>Advertising</xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="005">
                    <xs:annotation>
                        <xs:documentation>Amusement</xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
            </xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:schema>

I want to extract value 001 from

<xs:enumeration value="001">

For all tag

And text ‘Accountancy’ from

<xs:documentation>Accountancy</xs:documentation>

Using php reg ex match

how do I do this?

  • 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-21T13:58:10+00:00Added an answer on May 21, 2026 at 1:58 pm

    Try this for the first.

    preg_match("/<xs:enumeration value=\"(\d+)\">/", $string, $matches);
    print_r($matches);
    

    And for the second

    preg_match("/<xs:documentation>(.+)</xs:documentation>/", $string, $matches);
    print_r($matches);
    

    but XML parser would be a better solution. DOMDocument can handle it I think.

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

Sidebar

Related Questions

Following up on PHP regular expression to match alpha-numeric strings with some (but not
I have a few questions about security using PHP, I dont want to use
I'm currently scraping content from a website using PHP and YQL. I need to
I was able to extract user information from the social Graph API and display
Can someone help me with a regular expression that would help me do this.
I have this code: $abc = ' Hello Guys , Goodmorning'; I want to
I want to match these tags: <div>03-24-2010</div> <div>04-23-2011</div> With jquery: (div:contains([0-9]{2}-[0-9]{2}-[0-9]{4})) What do I
I want to implement jQuery Mobile, but only for mobile browsers. Is there a
I've been producing a letter compilation system (to save people time after a questionaire

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.