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

  • Home
  • SEARCH
  • 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 7447221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:32:41+00:00 2026-05-29T12:32:41+00:00

Can someone rewrite this javascript. The problem now is that 1 regex is only

  • 0

Can someone rewrite this javascript. The problem now is that 1 regex is only working( that one from email)

earlier question: link
I got advice here but I think I put it not good in my code

function checkform ( form )
{
    var rex = /[^a-z]/i;
    var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (!regex.test(form.email.value))
    {
        alert( "Please enter youre valid email address." );
        form.email.focus();
        return false ;
    }

    if (rex.test(form.name.value)) 
    {
        alert( "Please enter your name. no numbers or #$^& things allowed)." );
        form.name.focus();
        return false ;
    }

    return true ;
}
  • 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-29T12:32:42+00:00Added an answer on May 29, 2026 at 12:32 pm

    Assuming you want the two form fields to behave the same way, the first one is being tested for negative.

    You said the email one works, so perhaps you meant to write if ( ! rex.test(for.name.value) )

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

Sidebar

Related Questions

Can someone help me rewrite this regex to be non-exponential? I'm using perl to
I can only find mod rewrite examples/tutorials for query's, so can someone help me
can someone help me writing an RegEx for Apache Mod Rewrite? i wannt do
Can someone please rewrite this XAML into C# code ? <DataGrid.GroupStyle> <GroupStyle ContainerStyle={StaticResource GroupHeaderStyle}>
Can someone explain this result to me. The first test succeeds but the second
Can someone verify the integrity of this chunk of code? I want to decorate
I have a url rewrite that looks like this: RewriteEngine On RewriteRule ^cancun/tours/$ location-tours-listings.php?locationName=Cancun
Can someone help me with this? I'm feeling like I've been hitting my head
I'm learning Haskell now and I'm facing the following problem: I want to rewrite
I've been working on this for days and I can't find a proper solution,

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.