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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:30:13+00:00 2026-05-18T00:30:13+00:00

I want a regular expression to test that a string meets the following rules:

  • 0

I want a regular expression to test that a string meets the following rules:

  1. It must not begin with ..
  2. It must not end with ..
  3. It must not include special characters like !@#$%^&*, but can include ..
  4. It must not include two dots . side by side.

Sample valid input:

  • na.me (single dot in middle)

Sample invalid input:

  • .name (begins with dot)
  • name. (ends with dot)
  • na..me (includes two dots side-by-side)
  • $name (special character not allowed in any position)
  • name# (likewise)
  • na#me (likewise)
  • 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-18T00:30:13+00:00Added an answer on May 18, 2026 at 12:30 am

    I believe this should work:

    ^(\w+\.?)*\w+$  
    

    If not in ECMAScript, then replace the \w‘s with [a-zA-Z_0-9].

    The approach here is that instead of citing what’s NOT acceptable, it’s easier to cite what’s acceptable.
    Translation of the expression is:

    • Start with one or many letters, followed by zero or one period (.)
      • All of which can occur zero or many times
    • End with at least one letter
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I want a regular expression (Java) for a string in the following form:
I want to match a portion of a string using a regular expression and
I want to do the following with regular expressions but not sure how to
Is that possible to pass variable into regular expression pattern string in jquery (
How I can write regexp to variable in regular expression? $string = 'Test regular
I want to be able to run a regular expression on an entire file,
Let's say I want to write a regular expression to change all <abc> ,
Using Awk I want to match the entire record using a regular expression. By
I have some unicode text that I want to clean up using regular expressions.
Hi have some forms that I want to use some basic php validation (regular

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.