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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:21:06+00:00 2026-05-11T05:21:06+00:00

Is it possible to write a REGEX (search replace) that when run on an

  • 0

Is it possible to write a REGEX (search replace) that when run on an XML string will output that XML string indented nicely?

If so whats the REGEX 🙂

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T05:21:06+00:00Added an answer on May 11, 2026 at 5:21 am

    Is it possible to write a REGEX (search replace) that when run on an XML string […anything]

    No.

    Use an XML parser to read the string, then an XML serialiser to write it back out in ‘pretty’ mode.

    Each XML processor has its own options so it depends on platform, but here is the somewhat long-winded way that works on DOM Level 3 LS-compliant implementations:

    input= implementation.createLSInput(); input.stringData= unprettyxml; parser= implementation.createLSParser(implementation.MODE_SYNCHRONOUS, null); document= parser.parse(input); serializer= implementation.createLSSerializer(); serializer.domConfig.setParameter('format-pretty-print', true); prettyxml= serializer.writeToString(document); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that I want to parse using regex. It has the
I'm trying to write a regex in php that in a line like <a
Is it possible to write a regular expression to check whether all numbers of
Basically, I'm dealing with a horribly set up table that I'd love to rebuild,
I want to write a regexp for balanced braces constructs like {...} , {...
I have this expression ([^]+)|(\s\S*\s) which gets any characters that are in quotes and
here's a very simple js but i don't know where to begin. in a
MySQL manual is not very detailed about what expressions it supports, so I am
Looking for a non-cloud based open source app for doing data transformation; though for
I need to dynamically instantiate a web application from a console application. By this

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.