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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:06:07+00:00 2026-05-30T13:06:07+00:00

When people are posting some text on my website, they will sometimes insert a

  • 0

When people are posting some text on my website, they will sometimes insert a long line of hyphens, asterisks or full-stops like this

*********************************************************************

That will unfortunately destroy the layout on some result pages, and it’s kind of pointless (to me).

How should I handle this? Maybe a regex that will reduce more than X repeats of the same character to only 5. If so, then how…

Regex regex = new Regex("[\\*\\._-]{5,}");
string goodstring = regex.Replace(badstring, "-----");

But what if a user thought it was fun to write aaaaaaaaaaaaaaaaaaaaaaaaaa, then my regex would fail.

The question is. How do you think I should handle this problem and if you think I should handle it with a regex, then how do I write a regex that would remove unnecessary repeats of any character (and not just *.-_ like my own regex here)?

  • 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-30T13:06:08+00:00Added an answer on May 30, 2026 at 1:06 pm

    To answer your regular expression question:

    how do I write a regex that would remove unnecessary repeats of any character

    You can use a backreference to detect the same character entered more than once, for example:

    Regex regex = new Regex(@"(.)\1{4,}");
    

    However the main point of your question seems to be this:

    That will unfortunately destroy the layout on some result pages, and it’s kind of pointless (to me). How should I handle this?

    You should use stylesheets to specify what should happen when the text doesn’t fit into its container. For example, you can use the overflow property to set the content to hide or scroll on overflow, rather than having the default behaviour which is that overflowing content can overlap other elements on the page.

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

Sidebar

Related Questions

I have people posting their website address but variations are posted such as: theirsite.com
My table is posting and in that table, it shows all the posting people
People always advised me that if I am doing some application that should use
Many people use Mock Objects when they are writing unit tests. What is a
Hi I've searched some other posts, but most of them assumed that people knew
I have a common scenario that I am looking for some guidance from people
I have searched for some similar questions before posting - however I have a
I'm going nuts on this. (as most people posting here lol) I have a
In stackoverflow, and some other websites where people submits questions or posts, there is
I have an XML document that's being generated from some content that people are

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.