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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:39:59+00:00 2026-06-03T12:39:59+00:00

1)How to say in regular expression: increase match counter only if there are no

  • 0

1)How to say in regular expression: increase match counter only if there are no letters at all?

I came up with this:

"/^[^a-zA-Z]+$/"

and it seems to work, but I don’t get why "/^[^a-zA-Z]+/" doesn’t work while "/[^a-zA-Z]+$/" works?

2)What does this mean?: "/[a-zA-Z]+/" I thought it means that match counter will increase only if all the elements will be in range a-z or A-Z. But testing shows I’m wrong. Also tried this "/^[a-zA-Z][a-zA-Z]+/" but this also give 1 for “aa11”.

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-06-03T12:40:00+00:00Added an answer on June 3, 2026 at 12:40 pm

    The only correct regular expression you’ve posted is /^[^a-zA-Z]+$/. All the rest are wrong.

    You need the ^ and $ to anchor the match to the start and end of the string respectively.

    • /^[^a-zA-Z]+/ matches aaa111 because there’s no end-of-string anchor.
    • /[^a-zA-Z]+$/ matches 111aaa because there’s no start-of-string anchor.
    • /[a-zA-Z]+/ matches 111aaa111 because there’s no start- or end-of-string anchor. It matches if there’s any letter anywhere in the string.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my regular expression which accept only string and number characters..otherwise it's say
Is there a nice way to evaluate a regular expression range, say, for a
Let's say I have a regular expression that works correctly to find all of
Let's say for example that I have a regular expression like this: The quick
Let's say I want to write a regular expression to change all <abc> ,
I'm trying to think of a regular expression for this but not having any
Lets say i have a regular expression: match = re.search(pattern, content) if not match:
This is a follow-up from Perl regular expression to match an IP address .
Given a regular expression: /say (hullo|goodbye) to my lovely (.*)/ and a string: my
Is there a way to back reference in the regular expression pattern? Example input

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.