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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:05:15+00:00 2026-05-25T02:05:15+00:00

Why is this regular expression not working? Console.WriteLine(Regex.IsMatch(password, (?!^[a-zA-Z]*$))); As you can see the

  • 0

Why is this regular expression not working?

Console.WriteLine(Regex.IsMatch(password, "(?!^[a-zA-Z]*$)"));

As you can see the expression contains negative look ahead, so basically if the string starts and ends with alphabets it should reject it. But I get always true no matter what I input. Why is this happening?

  • 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-25T02:05:15+00:00Added an answer on May 25, 2026 at 2:05 am

    You regex matches nothing, which is not followed by a pure alphanumeric string. So every input matches that. Remember, the lookahead is not part of what is matched – it’s just a condition.

    Use this to match all inputs that do not start or end with alphanumeric:

    "^[^a-z](.*[^a-z])?$"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I update this regular expression to find and replace not just /news/
Why isn't this regular expression working? A correct email address does not pass the
I want to match D11-RONPLAYER_DEF_15_PO using this regular expression: D\[0-9]+-\[A-Z]*PLAYER_(DEF\[0-9]*)_(\[^_]+)_ but it does not
Can anyone please help me with this...I'm not very good with regular expressions and
I want to use this regular expression in Python: <(?:[^]*[']*|'[^']*'[']*|[^'>])+> (from RegEx match open
PS: I can't use DOM etc for this code as Xpath is not working
I found this regular expression in an old system i'm working on. (\s*)* I'm
Is this regular expression enough to catch all cross site scripting attempts when embedding
What's wrong with this regular expression? It won't work var patt = /[0-9]{2}/[0-9]{2}/[1-9]{4}/; if(patt.test(document.getElementById('date').value)
I have this Regular Expression that matches the following strings: <!-- 09-02-2009 ---> <!--

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.