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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:39:25+00:00 2026-05-25T17:39:25+00:00

I am using umbraco where the validation on fields is done by regular expressions.

  • 0

I am using umbraco where the validation on fields is done by regular expressions. In one field I want to allow users to style their text using the rich text editor (tinymce) but I still want to limit the number of characters they can enter.

I’m currently using this regular expression but it checks the total number of characters so includes the html.

^[\s\S]{0,250}$

Is there a regular expression that wouldn’t count the characters in html tags.

  • 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-25T17:39:25+00:00Added an answer on May 25, 2026 at 5:39 pm

    The short answer is no. At least, not with any sane regex, not without an advanced regex engine that allows recursion or balanced groups, and maybe not at all. A regex that can recognize and ignore HTML tags would have to parse the HTML to do it, and down that road lies madness.

    However, you could use some sort of preprocessing, such as jQuery on the client-side or something else on the server-side, to parse the HTML and strip out the tags before you apply length validation.

    Are you sure you want to do this, though? If you’re storing the styled input in a database, then those HTML tags are going to count against your column size just like everything else will. If you’re storing these in a varchar(250) column, you’re going to have to either count the HTML tags as part of that 250, or else strip them out and lose all the style information.

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

Sidebar

Related Questions

I'm using Umbraco 4.7.1 and have created a custom DocumentType called Partner. I want
Using PHP and MySQL, I want to query a table of postings my users
I'm creating some xslt's using Umbraco 4.5.2 and I want to add de set:distinct
Using Umbraco, which is quicker to load on a page... XSLT Macro or a
I am running a site using Umbraco 4. In Safari (Mac) when I refresh
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Ok, I am using umbraco forum module, and on the comment form it uses
I've created a menu in umbraco using XSLT. The menu is using the usual
I've been trying to install Umbraco using the Microsoft Web Platform Installer. I'm not
When using the latest Release version (4.0.4.2) of Umbraco, the tinymce3 control fails to

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.