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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:15:16+00:00 2026-05-20T18:15:16+00:00

Problem: Current regex pattern does not filter all lines. Adding ^ to the beginning

  • 0

Problem:
Current regex pattern does not filter all lines. Adding ^ to the beginning and $ to the ending of the pattern seems to break it as well. If I try it on http://www.regexlib.com it gives partial results using options(multiline & case insensitive). Using it in the application returns nothing at all.

Questions:

  1. Why is this regex not working with
    all lines and partially giving results.
  2. I thought this was .NET regex
    engine. Why does it work there and
    not here???
  3. Am I missing proper syntax or is the
    pattern just missing sommething
    crucial?? Regex always drives me crazy…

// Format: (KB980218)
//
// Example:
Security Update for Windows 7 for x64-based Systems (KB2479943)
Security Update for Windows 7 for x64-based Systems (KB2479943)
Windows Malicious Software Removal Tool x64 – March 2011 (KB890830)
Update for Microsoft Silverlight (KB2495644)
Security Update for Windows 7 for x64-based Systems (KB2483614)
Cumulative Security Update for Internet Explorer 8 for Windows 7 for x64-based Systems (KB2482017)
Security Update for Windows 7 for x64-based Systems (KB2425227)
Windows Malicious Software Removal Tool x64 – February 2011 (KB890830)
Security Update for Windows 7 for x64-based Systems (KB2479628)
Update for Windows 7 for x64-based Systems (KB2467023)
Windows Live Essentials 2011 (KB2434419)
Update for Windows 7 for x64-based Systems (KB2454826)
Security Update for Windows 7 for x64-based Systems (KB2475792)
Security Update for Windows 7 for x64-based Systems (KB2393802)
Security Update for Windows 7 for x64-based Systems (KB2485376)
Update for Windows 7 for x64-based Systems (KB976902)
Windows Malicious Software Removal Tool x64 – January 2011 (KB890830)
Security Update for Windows 7 for x64-based Systems (KB2419640)
Update for Internet Explorer 8 Compatibility View List for Windows 7 for x64-based Systems (KB2447568)
Cumulative Update for Media Center for Windows 7 x64-based Systems (KB2284742)
Update for Microsoft Silverlight (KB2477244)

Testing this function returns the title but no kb article number.

==================================================================================
Title:Security Update for Windows 7 for x64-based Systems (KB2479943)
KB#:
==================================================================================
Title:Windows Malicious Software Removal Tool x64 – March 2011 (KB890830)
KB#:
==================================================================================
Title:Update for Microsoft Silverlight (KB2495644)
KB#:
==================================================================================

//Main Method output example
Console.WriteLine("=====================================================================================");
foreach (string s in KbUpdates)
{
    string format = string.Format("Title:{0}\r\nKB#:{1}", s, GrabKBUpdate(s.ToString()));

    Console.WriteLine(format);
    Console.WriteLine("=====================================================================================");
}

public static string GrabKBUpdate(string updatestring)
{
    string result = null;
    string pattern = @"(((\w{2}\d{6}) ?)";
    string input = updatestring;
    Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);
    MatchCollection matches = rgx.Matches(input);

    if (matches.Count > 0)
    {
        foreach (Match match in matches)
           result = match.Value;
        return result;
    }
    return result;

}

Using this method above I get nothing. Using the below pattern on http://www.regexlib.com online regex tester for .net I only get partial results.

Matches for pattern: (((\w{2}\d{6}) ?)

Match   $1  $2
(KB890830)  (KB890830)  (KB890830)
(KB890830)  (KB890830)  (KB890830)
(KB976902)  (KB976902)  (KB976902)
(KB890830)  (KB890830)  (KB890830)
  • 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-20T18:15:16+00:00Added an answer on May 20, 2026 at 6:15 pm

    It ended up that the pattern needed was (KB\d+). Thanks anyways.

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

Sidebar

Related Questions

My current problem is that I have a JFrame with a 2x2 GridLayout. And
I came across a problem in my current application that required fiddling with the
Is it a deliberate design decision or a problem with our current day browsers
Here is my current question: I'm guessing that my problem (described below) is being
Problem, there's no method: bool ChangePassword(string newPassword); You have to know the current password
Another noob regex problem/question. I'm probably doing something silly so I thought I'd exploit
I just finished working out a memory allocation problem with the current program I'm
Current Problem In relearning jQuery/jQueryUI, I'm trying to call an event on an element
I am having problem closing current form when I call some other form from
Trying to solve my current problem of drawing an image on an Android MapView

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.