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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:04:54+00:00 2026-06-14T16:04:54+00:00

I would expect that the regular expression ^[a-z]*$ would not match random$something However, this

  • 0

I would expect that the regular expression ^[a-z]*$ would not match random$something

However, this matches when I try it on the shell:

~# echo "random$something" | grep "^[a-z]*$"
random

~# echo "aaaaa$something" | grep "^a*$"
aaaaa

Why is this happening?

I’ve seen this on both Solaris and RedHat Linux.

  • 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-14T16:04:55+00:00Added an answer on June 14, 2026 at 4:04 pm

    Note that if you just do

    echo "aaaaa$something"
    

    without the grep, the result is

    aaaaa
    

    This is because the shell is trying to interpret $something as a variable.
    If you change the double quotes to single quotes, you’ll see the expected behavior; that is no result.

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

Sidebar

Related Questions

One would expect that even though strings are immutable, value-equality and reference-equality would not
The following Java code will print 0. I would expect that this would print
Consider the following code: int i = 3 << 65; I would expect that
I recently wrote code that didnt work as i would expect, it was: message
I'm using NUnit mocks and would like to specify that I expect a call
I would expect the following code snippet to complain about trying to assign something
This is a question of design, not of existing functionality. I would like to
I am trying to determine if a string matches a regular expression pattern: expected
I'm trying to find a way to match a query to a regular expression
I am trying to write a regular expression to match ruby's list and hash

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.