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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:28:35+00:00 2026-05-16T22:28:35+00:00

I have some XML which I want to extract via a javascript regular expression.

  • 0

I have some XML which I want to extract via a javascript regular expression. An example of the XML is shown below:

<rules><and><gt propName="Unit" value="5" type="System.Int32"/><or><startsWith propName="DeviceType"/></or></and></rules>

I’m having problems extracting just the xml names “gt” and “startsWith”. For example, with the following expression

<(.+?)\s

I get:

“<rules><and><gt”

rather than just “gt”.

Can anyone supply the correct expression?

  • 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-16T22:28:35+00:00Added an answer on May 16, 2026 at 10:28 pm

    Well, \s matches whitespace. So you actually tell the regex engine to:

    <(.+?)\s
    ^^    ^
    ||    \ until you find a whitespace
    |\ slurp in anything (but whitespace)
    \ as long as it starts with an opening pointy bracket
    

    You could, for example use:

    <([^\s>]+?)
    

    but you should always consider this.

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

Sidebar

Related Questions

I have some XML data which includes URIs. I want to list the URIs
I want to get all xml elements (xml descendents) which have some attributes like:
I have an xml in which i have stored some html under comments like
I have a file which is an XML representation of some data that is
We have the usual web.xml for our web application which includes some jsp and
I have some XML in an XmlDocument, and I want to display it on
I have some xml files that contain text, which are displayed on my website.
I have an Android application which grabs some data from an external XML source.
I have Notepad++ and I got some XML code which is very long. When
I have some XML which I am reading by jQuery and printing on screen.

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.