Larry Steinle

December 1, 2013

HTML5 Required and Pattern Attribute Fallback

Filed under: RegEx,Web — Larry Steinle @ 11:45 pm
Tags: , , , ,

Continuing with the theme from the last article on an AutoFocus fallback, today we will learn how to support the Required and Pattern attributes.
(more…)

April 10, 2011

JavaScript Characters

Filed under: RegEx,Web — Larry Steinle @ 11:55 pm
Tags: , , , ,

While reviewing the C language I was reminded of the cType.h library. The cType library is a Character Type helper class. After short consideration I thought it might be helpful to have an equivalent in JavaScript.

(more…)

March 25, 2011

C# IsNumeric Function

Filed under: RegEx,VS.Net — Larry Steinle @ 2:32 pm
Tags: ,

I have been a Visual Basic programmer for the last ten years. I truly enjoy writing in this language. However, I also write software in C#. One of the things I have noticed that is missing from C# is a simple routine that tells me if a value is a number. Of course I could reference the Microsoft.VisualBasic namespace. Since I don’t want to be ostracized by the C# community I created a C# IsNumeric function using a regular expression instead.

(more…)

Advertisement

March 12, 2011

AdCommandTextParser: Parsing SQL Statements

Filed under: Active Directory,RegEx,VS.Net — Larry Steinle @ 11:48 pm
Tags: , , , ,

The most difficult task in the construction of the Active Directory Data Access Layer was parsing the SQL Statements so that the information would be easily accessible to populate the DirectorySearcher object. In today’s post we will review the capabilities of the parser followed by the sql statement parsing code.

(more…)

February 21, 2011

AD Path Helper

Filed under: Active Directory,RegEx,VS.Net — Larry Steinle @ 11:57 am
Tags: , ,

In the previous post, Introduction to Active Directory, we learned that ADSI paths are used to organize objects in Active Directory. A path consists of a protocol, host name, port number and distinguished name (DN). A DN consists of one or more relative distinguished names (RDN). An RDN is a simple key/value type. Today we will create three helper classes to ensure that our paths are well-formed with escaped special characters. (more…)

February 20, 2011

Use Regular Expressions to Detect SQL Code Injection

Filed under: RegEx,Security,SQL Server,VS.Net,Web — Larry Steinle @ 12:26 am
Tags: , ,
To gain unauthorized access and possibly control of another companies information hackers employ a technique called SQL Code Injection. This simple technique involves entering a sql statement inside a text box and submitting the request. When the server processes the page it can be tricked into executing the injected code. The best strategy to block SQL Code Injection is to use a stored procedure. For the times when you simply must use inline sql statements we will learn how to detect and block SQL Code Injection with the help of a few, simple, regular expressions.

(more…)

February 9, 2011

Use Regular Expressions to Clean SQL Statements

Filed under: RegEx,SQL Server — Larry Steinle @ 9:00 pm
Tags: ,
When writing programs that use inline SQL statements I prefer to format the sql statements for readability with solid comments in the sql statement. Sometimes the formatting or comments gets in the way during processing and must be removed. In this article I will demonstrate how to remove formatting and comments from a SQL Statement using Regular Expressions.
(more…)

January 30, 2011

String.Split On Steroids

Filed under: RegEx,VS.Net — Larry Steinle @ 9:25 am
Tags: , , , , ,

The String.Split function uses a separator to divide a string value into an array of string values. Unfortunately the split function does not support text qualifiers. As a result, if the separator is contained within a text qualified block of characters, the text block gets split.

In this article we will create a new extension called, FullSplit, that will implement the same basic functionality of the String.Split function with the added support of text qualifiers and assignment operators. When assignment operators are used the return value will be of type StringDictionary where the left side of the operator represents the DictionaryEntry.Key property and the right side represents the DictionaryEntry.Value property.

Finally we will conclude the article by updating the code from a previous post, Extending IEnumerable, to support dictionary entries by separating the key/value pair with an operator.

(more…)

Create a free website or blog at WordPress.com.