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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:44:37+00:00 2026-05-29T20:44:37+00:00

This regex currently accept dot at the end of nameserver. What I need is:

  • 0

This regex currently accept dot at the end of nameserver. What I need is: ns1.test.com. and ns1.test.com is accepted but not ns1.test.com..

var re = /^([a-z0-9][a-z0-9-]*\.)+[a-z]{2,3}\.$/i;

Help me please. Thanks in advance.

  • 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-29T20:44:38+00:00Added an answer on May 29, 2026 at 8:44 pm

    The optional operator is, a ?.

    So just make the regex:

    var re = /^([a-z0-9][a-z0-9-]*\.)+[a-z]{2,3}\.?$/i;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am using this code: var regex = new Regex(@<span id=point_total class=tooltip oldtitle=.*?
(\.|dot) This regex matches all .s and dots but it's also puts them into
i'm currently using this regex /^([0-9\(\)\/\+ \-]*)$/, which is fine,but the problem is i
I'm currently using this regex ^[A-Z0-9 _]*$ to accept letters, numbers, spaces and underscores.
Currently I have this regex: [\d\.]+ I'm testing it with Regex Hero. You can
^. (?=.{15,})(?=. \d)(?=. [a-z])(?=. [A-Z])(?=. [!@#$%^& +=]).*$ This is the regex I am currently
This regex: ^((https?|ftp)\:(\/\/)|(file\:\/{2,3}))?(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3} (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(((([a-zA-Z0-9]+)(\.)?)+?)(\.)([a-z]{2} |com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum))([a-zA-Z0-9\?\=\&\%\/]*)?$ Formatted for readability: ^( # Begin regex / begin
I am currently using this regex to get the page number from the url:
I'm currently modifying my regex for this: Extracting email addresses in an html block
I'm currently using this regex in my php script to validate email addresses: preg_match_all(/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i,

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.