Tagged Questions
5
votes
1answer
274 views
Is there anyway to minimize the following code? combine regex for example?
i have built the following code using help from people at stackoverflow,
but i am pretty sure it can be minimized,but since i dont know regex very good (actually hardly), i do not know how to do it.
...
4
votes
2answers
111 views
How to reduce this archive detection function and make it supports wildcards
The function below is called to determine if a given file is the archive of another file. I'm also looking for a way to supports wildcards. For example if the original log file is serverw3c.log and we ...
3
votes
4answers
280 views
Extending String/Regex to be simpler in c#
I'm working on some extensions to simplify the Regex object usage in C#. Regex, RegexOptions, and MatchCollection are really nasty IMO and I'm trying to extend string with some regex functionality ...
3
votes
3answers
727 views
Regular Expression replace specific characters
Does anyone know of a better / cleaner way to write the following:
GetSafeTagName(txtUserInput.text);
public static string GetSafeTagName(string tag)
{
tag = tag.ToUpper()
.Replace("'","`")
...
3
votes
1answer
155 views
Is my regex ok to parse what I want or should I change anything to make it more …
I need to classify each line as "announce, whisper or chat" once I have that sorted out I need to extract certain values to be processed.
Right now my regex is as follow:
var regex = new ...
2
votes
1answer
532 views
Evaluate/Refactor my ASP.NET XSS Security Helper Class
I am maintaining a site with significant security concerns and I wrote a helper class for validating potential XSS attacks. The ValidateRequest method is meant to evaluate the HttpRequest for any ...
2
votes
2answers
249 views
Code Improvement: Copy Regex named capture groups to strongly typed object
This code works to copy named capture groups of a Regex to the same named properties of a strongly typed object. However, it's not pretty. Someone mentioned I should use polymorphism to at least ...
2
votes
0answers
89 views
Mathematical expression evaluator.
Code reviews and suggestions to improve coding style are welcome.
using ExpressionEvaluatorLibrary;
namespace ExpressionEvaluator
{
class Program
{
static void Main(string[] args)
{
...
1
vote
1answer
143 views
RegExp selecting strings surrounded by brackets
My purpouse is to select every character which is surrounded by { and }, this is easily achievable using this regexp {\w*}.
I've developed an extenstion method for strings:
public static ...
1
vote
1answer
124 views
Help me optimize this code using Regular Expressions in C#
I have a requirement to capture string in a specific format of * [Numeric Digits] *. This is how I have done right now but I think it would be faster with Regular Expressions. I dont have a lot of ...
1
vote
1answer
137 views
Need regex wizard to improve this - eliminating unwanted namespaces
Techies--
I know there's a better way to do this, but need an infusion of genius!:-) I am trying to eliminate unwanted namespaces. This code works, but its remedial and redundant.
string sPattern = ...
1
vote
2answers
301 views
A faster way to look up for a url in a WebRequest/WebResponse html
What I'm trying to do here is get an RSS feed and append an Enclosure XML node to each item, which has a link to a video file (wmv).
Try the below code with
url = ...
1
vote
1answer
22 views
string compare, sort, regex split
I am writing a simple code to accept/read a input of lines from a text file, split it into my class variables, sort them and finally display the input in the ordered form. But I am struggling past ...
1
vote
0answers
96 views
Looking for a good heuristic in C# that will try to detect if the user is trying to search via regex [closed]
I am not sure if this question belongs here or on StackOverflow since my implementation, which compiles and sort of works is not the right solution, because I have not fully decided on what the ...
1
vote
1answer
300 views
Extension Method for Creating Types from Regular Expression Match Groups
I've been doing some parsing with regular expression named capture groups and decided it might make sense to write an extension to handle this.
The code below will create an instance of a specified ...