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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:17:39+00:00 2026-06-18T05:17:39+00:00

Iam trying to search and replace with regular expression, but it is not working.

  • 0

Iam trying to search and replace with regular expression, but it is not working.

I have some html like so:

<p><b>Noten</b></p>
<p><b>somethingelse</b></p>
<p><b>random extra</b></p>
<p><b>something 3</b></p>

And want it like so:

<h2>Noten</h2>
<h2>somethingelse</h2>
<h2>random extra</h2>
<h2>something 3</h2>

But it how do i find all the right elements?
I only can find the ones without the spaces or numbers, like so:

<p><b>[a-z]*</b></p>

and i don’t know how to replace it so that the <p> and <b> tags change in <h2>

  • 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-18T05:17:41+00:00Added an answer on June 18, 2026 at 5:17 am

    Test It

    var regex = /<p><b>([^>]+)<\/b><\/p>/ig;
    var s="<p><b>Noten</b></p>";
    var result = s.replace(regex, "<h2>$1<\/h2>");
    alert(result);
    

    but I Recommend you to Use Dom and JQuery for do This It is more easier

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

Sidebar

Related Questions

I am trying to do the following search and replace, but for some reason
I am trying to replace some content using regular expression. I am able to
I am trying to write a bash script(script.sh) to search and replace some variables
Can someone provide a regular expression to search and replace illegal characters found Example,
I am trying to use regular expression to search a document fo a UUID
I am trying to search and replace some of the text (eg 'Smith, John')
I'm trying to do a URL GET variable replace, however the regular expression for
I am trying to use perl to search and replace some outdated MySQL commands
I am trying to modify the output stream to search/replace some XHTML tags returned
I am trying to search for files which matches following expression with sed [a-zA-Z0-9]{1,10}\s{1,5}\

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.