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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:57:25+00:00 2026-06-02T02:57:25+00:00

^.*(?=.*[0-9]).*$ I saw this posted in someone’s code. Is this a valid regex? I

  • 0

^.*(?=.*[0-9]).*$

I saw this posted in someone’s code. Is this a valid regex? I know the ? is supposed to make the items before it optional like abc? makes c optional. But ? is at the start of a capturing bracket. What does that mean?

  • 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-02T02:57:26+00:00Added an answer on June 2, 2026 at 2:57 am

    ? alone means : OPTIONALLY match what was before.

    However, (? .. ) is used for assertions…

    In your case, (?= is a look-ahead assertion, meaning : match if ONLY (what’s in the brackets) follows.

    Reference


    (?: … )

    Non-capturing parentheses. Groups the included pattern, but
    does not provide capturing of matching text. Somewhat more efficient
    than capturing parentheses.

    (?> … )

    Atomic-match parentheses. First match of the parenthesized
    subexpression is the only one tried; if it does not lead to an overall
    pattern match, back up the search for a match to a position before the
    “(?>”

    (?# … )

    Free-format comment (?# comment ).

    (?= … )

    Look-ahead assertion. True if the parenthesized pattern
    matches at the current input position, but does not advance the input
    position.

    (?! … )

    Negative look-ahead assertion. True if the parenthesized
    pattern does not match at the current input position. Does not advance
    the input position.

    (?<= … )

    Look-behind assertion. True if the parenthesized pattern
    matches text preceding the current input position, with the last
    character of the match being the input character just before the
    current position. Does not alter the input position. The length of
    possible strings matched by the look-behind pattern must not be
    unbounded (no * or + operators.)

    (?<! … )

    Negative Look-behind assertion. True if the parenthesized
    pattern does not match text preceding the current input position, with
    the last character of the match being the input character just before
    the current position. Does not alter the input position. The length of
    possible strings matched by the look-behind pattern must not be
    unbounded (no * or + operators.)

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

Sidebar

Related Questions

I saw someone writing code like this , in a C++ class: int foo
We all know that things like this are valid in c++: const T &x
I saw this C# using statement in a code example: using StringFormat=System.Drawing.StringFormat; What's that
Saw this post at CodeProject for FCKEditor. Can someone explain what about the new
I saw a tweet recently that confused me (this was posted by an XNA
Hi All I saw this question posted on a site asked in a technical
(apologies if this is a duplicate ... i posted but saw no evidence that
I saw this in a part that never gets called in a coworker's code:
I saw this question and it motivated me to look again (without success) at
I saw this posting which explained how to get BC3 working as the diff

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.