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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:44:12+00:00 2026-06-04T04:44:12+00:00

I always thought in regex, ^ and # like ‘verb’ in must follow something,

  • 0

I always thought in regex, ^ and # like ‘verb’ in must follow something,
such as ^a, line begin with a, or #a, and line end with a, But ^# to me, like # is not a ‘verb’ in this case, like a is a object of the verb ‘^’

Is there anyone can give me a better explanation about this?

  • 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-04T04:44:13+00:00Added an answer on June 4, 2026 at 4:44 am

    I’m going out on a limb here and I’m guessing you actually want to ask why ^$ matches the empty line.

    The key to understanding this is that not everything a regex matches must actually be a character (or characters), it can just as well be a position in the string. Regex tokens that match positions are called “anchors” or “assertions”. They don’t actually consume any text, they just make sure that the regex engine currenty is at a certain position in the string.

    So, for example, ^ matches if the regex engine is currently at the start of the string. In some circumstances, depending on the current settings, it may also match at the start of the current line. In any case it matches before the first character.

    Similarly, $ matches at the end of the string (or line); more precisely, it matches before the terminating linefeed, if there is one.

    Therefore, ^$ only matches if there are no characters between the start of the string/line and the end of the string/line.

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

Sidebar

Related Questions

I always thought that you could use OR in a LIKE statment to query
I always thought they were about the same thing but someone pointed me out
I always thought that parentheses improved readability, but in my textbook there is a
I always thought that the nullable types of the .NET framework where nothing but
I always thought that jinja was better because of template extending.. but them I've
I always thought that a look-behind assertion in Java's regex-API (and many other languages
The monthRegex regular expression always returns true, even if dateInput is something like December
I always thought operator is determined if the given variable is of the given
I always thought that if you didn't implement a heartbeat, there was no way
I always thought that when you dropped a control onto an .aspx page that

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.