.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Regex pattern for validating IPv6

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Can anyone can make a regular expression pattern for validating IPv6 (not IPv4)?

Ipv6 has many formats and aliases. I tried making the pattern but written in a lot of codes (i'm not sure my code below will be 100% accepting valid formats and 100% declines invalid formats).


View Complete Post

More Related Resource Links

Regex pattern for text extraction within html tag

Hi guys, ive originally posted this question in the "visual basic general" category and was forwarded here.   I am looking for the regex pattern for text extraction within this html tag  <span class="listingTitle">Inner Balance</span> This is the full link if its needed: http://www.yellowpages.ca/search/si/1/Estheticians/Calgary+AB Get I get some assistance please.

What is the Regex pattern of SessionId

Hi asp.net 4.0 I wonder what the Regex pattern for session id is?

What components of a RegEx Pattern need to be deleted to cancel the appending of Math Operators to t


The following RegEx Pattern ID's Constants in Excel Formulas.  In addition, the Pattern appends the Operator (which actually preceeds the Constants in the Excel Formula) to the Constants and I would like the Operator to disappear as prepended of appended.

Possible candidates for deletion are: >>>>                  [^-+*/^<>=]+    [-+*/^<>]

Dim Pattern As String = "(-?(('[\s\S]*?'!\w+)|(\([\s\S]*?\))|([^-+*/^<>=]+)))([-+*/^<>][<>=]?|$)"

That said, in case I need a revised prepending-pattern in the future, I would like two solutions (Match Patterns) :

1) No Operators appended or Prepended at all (Constants only)


2) Operators (which precede the Constants in Excel Formulas) Prepended to the Constants


Thanks! Dennis

Help in validating pattern


I need to validate particularpattern

Either LT or FL or given below string should rerun true

But current regular expression is even validating L or F or C or O ..

Please correct me what i am doing wrong

   1. strings isValid = Regex.IsMatch(strToCheck, "[LT]|[FL]|[CD]|[OS]|[MP]|[IR]|[PF]|[CM]|[NP]|[NA]|[NB]");  

Kamran Shahid Senior Software Engineer/Analyst (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web])

Validating a pattern with optional characters


I am trying to build a game i have following requirement.

For e.g  Regex = "GAME REGEX"

i want to make a regular expression where it would validate strings like

"AME REGEX"        // G missing all other chars present
"GME REGEX"       // A missing all other chars present
"GAE REGEX"       // M missing all other chars present
"GAM REGEX"      // E missing all other chars present
"GAME EGEX"      // R missing all other chars present
"GAME RGEX"     // E missing all other chars present
"GAME REEX"     // G missing all other chars present
"GAME REGX"    // E missing all other chars present
"GAME REGE"     // X missing all other chars present

i.e any charcater can be optional.

1) how can i accheive this?
2) Is there other classes in .net where i can do the above mentioned task or a combination of regex and other classes in .net ?

3) My Next task is that any 'n' chars can be optional at any position so it wo

Difficult REGEX pattern match [For newbie]


I was hoping someone with far more experience with regular expressions, particularly in .NET, could help me come up with a pattern. I have a program that will be reading in sql files and creating a deployment manifest based on the files. I need to match the file names to first, validate that they match a predetermined pattern. Then, extract certain parts of the file name for metadata in the manifest. The file nameing pattern is like the following:


So, for example, I may have a file named MyProj_sp_GetCustomers_By_ID_2.sql. I need to first do a match on the name to verify that it ends in a number between 1 and 9999. I will then have to assume that the file was named properly (this is a new naming sceme and numbers were not allowed in the proc names previously). the next step will be to extract the Project, ProcName, and Version to properties.

All-in-all this seems relatively simple. However, my sticking point is the proc name. It can be any length and contain 0 or any number of underscores. How do I create a regex that essentially "says" the following:

 - Project name is everything up to the firt underscore.
 - Version is a numeric value between 1 - 9999 that comes after the last underscore and before the file extension.
 - The procedure is everything in-betwe

need a REGEX pattern to match


need help with validating a 9-digit number.
CANNOT BE -----------

4-5 position(s) CANNOT BE 00 --

6-9 position(s) CANNOT BE 00 --

The nine numbers CANNOT BE sequential -- but only the following 4 four below, for the time being --

I had just managed to get the first piece done --

Thanks a TON for the help friends.

does static Regex.Match(string input, string pattern, RegexOptions ops) cache ?


in msdn, it is said that static Regex.Match(string input, string pattern) caches for future uses,

but it doesn't say whether static Regex.Match(string input, string pattern, RegexOptions ops) caches.

Then does it cache? Does it help to promote performance at creation?


Dialogs and ViewModel - Using Tasks as a Pattern

The ViewModel/MVVM pattern continues to gain popularity, with a blog post showing up every so often, and with tweets and retweets popping up even more often :-). At the same time, there are some interesting topics beyond the core pattern that continue to fuel experimentation. A big one amongst those is how should applications use dialogs when using the view model pattern.

The crux of the problem is the desire to keep the view model independent of UI concerns, and ensure it can be tested in a standalone manner, but that often comes to odds when you want the view model to launch a dialog, and/or do some work after the dialog is closed.

Prototype Design Pattern in C#. Vb.NET

Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype

Adapter Design Pattern in C#, VB.NET

Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

Singleton Design Pattern in C#, Vb.NET

Ensure a class has only one instance and provide a global point of access to it.

The Decorator Pattern & Extension Methods

The decorator pattern provides a formal way to add new functionality to an existing type, without sub-classing. First question: What is wrong with classical inheritance? In and of itself, nothing is wrong with the good old Is-A relationship. It is very common to derive a new class from an existing base class in order to override a few virtual members, and add a pinch of new functionality.

Implementing Continuous Scrolling UI Pattern in ASP.NET

When you have numerous records to show, we have to resort to Paging. There is a better alternative to display voluminous data (especially read only data) while providing a better user experience & also making efficient use of server bandwidth - the Continuous Scrolling or Infinite Scrolling UI Pattern. Read on to know more about how to implement Continuous Scrolling UI Pattern in ASP.NET with a GridView.

Factory Pattern in asp.net

The job of the Factory design pattern is to create concrete sub classes. You can see the Factory design pattern used throughout the .NET Framework.

The essence of the Factory Pattern is to "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses." Factory methods encapsulate the creation of objects. This can be useful if the creation process is very complex, for example if it depends on settings in configuration files or on user input.

Singleton Design Pattern in Asp.net using C#

When we want to make a only one instance of a class and also making sure that there is a global access point to that object then the design pattern we user is called Singleton. The pattern ensures that the class is instantiated only once and that all requests are directed to that one and only object.

The Factory Design Pattern

Software architects generally think in terms of high-level abstractions rather than low-level programming details. Representing a system in terms of high-level abstractions promotes understanding of the system and reduces its perceived complexity. One such set of abstractions is software design patterns. They have been successfully applied in the past to simplify and solve recurring problems in software design.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend