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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:08:31+00:00 2026-05-13T22:08:31+00:00

Im working on a response filter. Im trying to catch all expresion: $sometext.sometext$ with

  • 0

Im working on a response filter. Im trying to catch all expresion: $sometext.sometext$ with the following regular expression: ^\w+?.\w+?\$

In my implementation it looks like:

public override void Write(byte[] buffer, int offset, int count)
{
    // Convert the content in buffer to a string
    string contentInBuffer = UTF8Encoding.UTF8.GetString(buffer);


    string regex=@"^\\w+?\.\w+?\$";
    RegexOptions options = RegexOptions.Multiline;

    MatchCollection matches = Regex.Matches(contentInBuffer , regex, options);
    foreach (Match match in matches)
    {
        string value = match.Value;

    }
    outputStream.Write(UTF8Encoding.UTF8.GetBytes(contentInBuffer), offset, UTF8Encoding.UTF8.GetByteCount(contentInBuffer));

}

The issue is when I write $Catch.Me$ on a aspx page It wont get caught by my regular expression in the write method. What Im I missing?

  • 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-13T22:08:31+00:00Added an answer on May 13, 2026 at 10:08 pm

    You are missing the first $ in your regex pattern. Should be: ^\$\w+?\.\w+?\$. If you use this, then it should match.

    I’m sure there are others, but one way to test your .NET reg ex patterns is to use this online tester.

    The other problem you might have is that ASP.NET breaks the output into multiple chunks, so your filter could be called multiple times (with each chunk that needs to be processed). That could make your regex patterns not match because the whole page is not in there together. Here are a couple of articles related to this and some solutions:
    Article 1 @ west-wind.com, Article 2 @ highoncoding.com.

    The only other thing that might be a problem would be if the encoding is not right. In the west-wind article above, he does the following for his GetString and GetBytes methods:

    Encoding encoding = HttpContext.Current.Response.ContentEncoding;
    string output = encoding.GetString(..);
    byte[] buffer = encoding.GetBytes(output);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

`I am working with an API that sends back an XML response upon request.
It seems to me that Response.Cache.SetVaryByCustom(mykey); is not working from within ASCX User Controls.
To start off, here is the JSON response that I've been working on: {
My app, Datastore, webapp2, and form-specific responses are all working :) but I need
I'm trying to traverse an AJAX response, which contains a remote web page (an
I'm working on filter that should transform an output with some stylesheet. Important sections
I have a filter and parameters in web.xml web.xml is like this: <filter> <description>
I use the following attribute to decorate my BaseController class. public class OutputCompressAttribute :
I am working on an Filter Attribute for ASP.Net MVC that will return a
I am trying to get [ CompressFilter ] working with donut caching and running

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.