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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:26:11+00:00 2026-06-11T02:26:11+00:00

If I have this in a Postgresql 9.1 column: foo foo <th id=ddd> foo

  • 0

If I have this in a Postgresql 9.1 column:

foo foo <th id="ddd"> foo foo <th id="www"> foo

And I want it to update to this:

foo foo <th> foo foo <th> foo

I’ve tried regex_replace, but I have not succeeded.

  • 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-11T02:26:13+00:00Added an answer on June 11, 2026 at 2:26 am

    Assuming you have a table like this:

    CREATE TABLE table1
    (
      a character varying NOT NULL,
      ...
    )
    

    You can use the following regexp_replace:

    update table1 set a = regexp_replace(a, '(.*?)<(\w+)\s+.*?>(.*)', '\1<\2>\3', 'g');
    

    The 'g' flag indicates to replace all matching patterns, not only the first one.

    With this input:

    foo foo <th id="ddd"> foo foo <th id="www"> foo<div id="hey">
    

    I get the following ouput:

    foo foo <th> foo foo <th> foo<div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

postgreSQL question...I have an update query below which updates a column with the results
I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1
I have a table in my postgresql 8.4 database like this: id(serial), event_type_id(id, foreign
In my Postgresql database, I have a timestamp without time zone with this value
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
I have a column in a PostgreSql database that is defined with type boolean[]
I have a column in the PostgreSQL database which contains Arabic data. When reading
I have a text[] ARRAY column within a PostgreSQL table and I need to
I use PostgreSQL database and in one table I have the datetime column edit_user
Traditionally I have always used an ID column in SQL (mostly mysql and postgresql).

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.