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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:22:13+00:00 2026-05-29T09:22:13+00:00

I need a regular expression to help me make a match in my string.

  • 0

I need a regular expression to help me make a match in my string. This is the line that contains the info that I need:

<td width="140" height="18"><a href="users_folders.cfm?viewfolder=86&viewsub=20207&addSub=20202" class="folderNav"><strong>087690898</strong></a></td>

What I need to pull out of it is the address of the href "users_folders.cfm?viewfolder=86&viewsub=20207&addSub=20202" and the value stored between the two strong tags 087690898. So I just need to identify lines that look like this.

So I have figured it out to this point:

(Match any char or digit) (Match < a href=”) (Match any char or digit) (Match class=”folderNav”>)

Which I have created this as my regular expression:

[a-z](< a href=”)[a-z](class=”folderNav”>)

Once I have identified this string, I can parse it pull the values I need, but it the identifying the string I am having an issue with. I am new to regular expressions, and not sure exactly how to do this. I know m regular expression is flawed. I am using C#.

Also, I know you shouldn’t use Regex on HTML, but for this, I dont mind a quick and dirty solution.

  • 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-29T09:22:14+00:00Added an answer on May 29, 2026 at 9:22 am

    Although the purists will condemn me to eternal damnation for breaking the regex/HTML rule, here’s what you need:

    string line = @"<td width=""140"" height=""18""><a href=""users_folders.cfm?viewfolder=86&viewsub=20207&addSub=20202"" class=""folderNav""><strong>087690898</strong></a></td>";
    Match match = Regex.Match(line, @"<a href=""(?<addr>[^""]*)"" class=""folderNav""><strong>(?<val>[^<]*)</strong></a>");
    string addr = match.Groups["addr"].Value;
    string val = match.Groups["val"].Value;
    

    The (?<name>expression) parts are called “named matched subexpressions”; you may read more about them by following the link to MSDN.

    In the code above, we’re using named subexpressions for matching your address and your value. In each case, we allow any character to be matched, except for the expected terminator. In the case of the href address, the attribute value ends just before the "; thus, we match [^"]*. In the case of the <strong> value, the element text ends just before the < (of the closing tag); thus, we match [^<]*. The rest of the regex pattern is verbatim.

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

Sidebar

Related Questions

I need a regular expression that will match this pattern (case doesn't matter): 066B-E77B-CE41-4279
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
I need some help to model this regular expression. I think it'll be easier
Hello I need help with Regular Expression, I want to match each section (number
I have a string like this ch:keyword ch:test ch:some_text I need a regular expression
I'm trying to write a regular expression to match a string that may or
I need a regular expression that can be used with replaceAll method of String
I need a regular expression to match strings that have letters, numbers, spaces and
I need some help with some regular expression problems I am having. First off,
Who can help me with regular expression? I need to remove a part of

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.