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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:32:35+00:00 2026-05-19T01:32:35+00:00

I’m learning about regular expressions for a script I will be writing down the

  • 0

I’m learning about regular expressions for a script I will be writing down the road, but I’ve hit a stopping point. I basically understand what ?= and ?! do, they’re “lookaheads”. To borrow and example: /Win (?=98)/ only matches “Win ” if it is followed by “98” whereas /Win (?!XP)/ would match “Win ” only if it was not followed by “XP” . . . right?

Now I really don’t get the ?: delimiter. And I haven’t found a decent example of it and I’m just really, really confused about it. :/ I understand it’s supposed to match the entire contained pattern or something?

One more thing I’m confused about are backreferences. Here’s on example I found: the regular expression /<(\S+).*>(.*)<\/\1>/ is supposed to match “any tag”. I’m just confused as to what the number “1” refers the browser to . . . is it the first match – in which case I would think it would refer to the < character – or something else?

I’m just now dabbling into the world of regular expressions and would love some clarification on these concepts, thank you all 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-05-19T01:32:35+00:00Added an answer on May 19, 2026 at 1:32 am

    Your thoughts on the lookahead assertions are correct.

    \1 refers to the first submatch in parentheses, i.e. whatever was matched by the (\S+) in your example. \2 refers to the second (in the example, (.*)) and so on.

    ?:, on the other hand, means that that set of parentheses should not be tied to a reference like \1. You use it if you need parenthesis for something but don’t really care about getting the matched text later on. So, in the regular expression /(?:abc)def(ghi)/, \1 would not expand to abc (because we switched that off using the ?:), but to ghi.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.