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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:25:17+00:00 2026-06-03T21:25:17+00:00

Using the follow regex: \[\w* \w* \d{2} [\w:]* \d{4}\] \[error\] \[client .*?\] .*? Using

  • 0

Using the follow regex:

\[\w* \w* \d{2} [\w:]* \d{4}\] \[error\] \[client .*?\] .*? Using HTTP not .*?<br /> 

I get the following results (where yellow boxes indicate a match):

Sublime Text 2

Raw Text: http://pastebin.com/vSi0mLGv

The bottom two sections are correct. I want all sections that contain: &lt;&lt;&lt;NOTICE&gt;&gt;&gt; Non-Prod Server: Using HTTP not HTTP/S

The top section however, contains the correct string (similar to the bottom two), but also comes with a whole other chunk that I do not want:

[Thu May 10 17:43:48 2012] [error] [client ::1] Current Name:
DashboardBar_projAnnualReview200, referer: http://
localhost/test/pages/TestPage.php<br />`

I know this comes down to regex being greedy, but how can I go about making it do a lazy evaluation for the <br />, if that’s even the right way to go about it. I’ve tried (<br />)*? and others to no avail.


Other Information:
I am using Sublime Text 2, and performing a regex search if anyone wanted to recreate the image.

  • 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-03T21:25:18+00:00Added an answer on June 3, 2026 at 9:25 pm

    Greediness is not the problem, eagerness is. The regex engine starts trying to match at the earliest opportunity, and it doesn’t give up until every possibility has been exhausted. Making quantifiers non-greedy doesn’t change that, it just changes the order in which the possibilities are tried.

    It’s not the * in .* that’s causing your problem, it’s the .. You need to use something more restrictive, because it’s allowing the match to start too early. This regex works as desired because I’ve replaced the .*? with [^][]*, which matches any characters except ] or [:

    \[\w* \w* \d{2} [\w:]* \d{4}\] \[error\] \[client [^][]*\] [^][]* Using HTTP not .*?<br />
    

    I don’t know what regex flavor SublimeText uses, so you may need to escape the square brackets inside the character class:

    \[\w* \w* \d{2} [\w:]* \d{4}\] \[error\] \[client [^\]\[]*\] [^\]\[]* Using HTTP not .*?<br />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the follow command to get a list of FileSystemInfo's IList<FileSystemInfo> requestFiles =
I would like to do the follow redirection using htaccess: From: http://www.mywebsite.com/home/?page_id=273&mnth=8&yr=1993 To: http://www.mywebsite.com/
Having follow the tutorial at http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/ to integrate the MapKit into my application. However,
Im trying to follow a tutorial that is using SBJsonParser to get twitter feeds,
I'm trying to follow http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/ And have created a very simple example http://jsfiddle.net/6wbZQ/ It's
I am using the http://bassistance.de/jquery-plugins/jquery-plugin-validation/ plug in with the follow pseudo block that I
i am using the following regex [^a-zA-Z\d!-] pattern in c# to clean special characters
I am using Java regex. I have a String as follow String s =
I want to match a string using REGEX which follows the syntax: Text/number So
This is a follow-up to my question about using multi-line regex in Vim .

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.