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

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

Regex match a number between 100 and 200 and no letters

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :.NET Framework

Hello i`m new in regex and i relly need some help how to fin a solution in this problem

match a number between 100 and 200 inclusive and no letters allowed

Thx in advance hope some one will help me with this

Best regards


View Complete Post

More Related Resource Links

The number of members in the conceptual type ... does not match with the number of members on the ob



I've added a scalar property to an entity and now ASP.NET Dynamic Data scaffolding throws this error:

The number of members in the conceptual type 'TrainingModel.Users' does not match with the number of members on the object side type 'TrainingModel.Users'. Make sure the number of members are the same.

This happens at the following line in global.asax:
model.RegisterContext(typeof(TrainingModel.TrainingEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Please help!

Regex for checking number greater than 9

Hi All , I need to write a regex which can check for a number greater than equal to 9 .  

REGEX does not match when line ends with the characters.. also, how to negate words that contain the

\S*(ai|ie)\S*   seems to match all words with characters ai and ie in them.  However it does not match if the line ends with them, how can fix that?Also, how can I match all words that DO NOT contain those characters.. I've tried ?! and [^ to no avail.Thanks in advance for any help or information!

How to extract City State Zip using Regex match

Hi there - I am parsing a file which contains customer address in the following 2 formats:   Format #1 12345 Melrose Place New York NY USA 12987     Format # 2: 12345 Melrose Place New York NY 12987   I need to put the data into Address, City, State and Zip fields. I am able to parse and put the data (specifically line 2) in the fields for format #1 but am having issues doing the same for format # 2 because format # 2 doesn't have USA as a reference point. Below is my code if any expert can help that will be appreciated Dim AddressChunk As String = tokenizer.NextToken() If AddressChunk.Contains("USA") Then _State = AddressChunk.Substring(AddressChunk.IndexOf("USA") - 4, 2).Trim _City = AddressChunk.Substring(0, AddressChunk.IndexOf("USA") - 4).Trim _Zip = Regex.Match(AddressChunk, "\d{5}").Value Else _Zip = Regex.Match(AddressChunk, "\d{5}").Value _State = AddressChunk.Substring(Regex.Match(AddressChunk, "\s[a-zA-Z]{2}\s\d{5}").Value - 5).Trim _City = End If

RegEx for numbers, letters & underscores only

I have this code:public bool IsAlphaNumeric(String strToCheck){  Regex objAlphaNumericPattern=new Regex("[^a-zA-Z0-9]");  return !objAlphaNumericPattern.IsMatch(strToCheck); } how do I modify the Regex to also accept underscores? 

[regex] Extracting number preceding a particular text (in this case area unit).

Hi there, I'm looking for a regex to extract two numbers from the same text (they can be run independently, no need to extract them both in one go. I'm using yahoo pipes. Source Text: S$ 5,200 / month Negotiable, 1,475 sqft / 137 sqm (built-in) - Apartment, 10 Anson Road (D02) Need to extract as a number: 1,475 and also (but can be extracted on a separate instance) Need to extract as a number: 137 any guidance will be greatly appreciated. thanks in advance Paco

Wierd case of: Msg 213, Column name or number of supplied values does not match table definition

Hi, I'm working on several triggers (that happen after insert or update) in order to log the changes in a different table. They all follow a similar syntax and are working fine, except for this one... I've reduced the next code to the minimum that gives an error, so we can safely assume the other parts of the trigger are working fine. INSERT INTO [Adt].[WardUnitStayLog] SELECT t.* FROM [Adt].[WardUnitStay] t INNER JOIN inserted i ON i.[Id] = t.[Id]; I've used this same syntax (but on different tables) in other triggers, and these are working perfectly fine. The above query provides the next error: Column name or number of supplied values does not match table definition. I've checked both tables for differences in the columns, but to no avail... (I've checked them manually and by outerjoining the information_schema.columns) (I've also checked the order in wich these columns are defined, they match over the two tables) These are the creation scripts for the tables: CREATE TABLE [Adt].[WardUnitStay] ( [Id] [dbo].[Id] IDENTITY(1,1) NOT NULL, [UnifiedUnitStayId] [dbo].[Id] NOT NULL, [WardCd] [dbo].[Cd] NOT NULL, [_FirstAtTm] [dbo].[Dtm] NOT NULL, [_IsReservation] BIT NOT NULL, [_LastAtTm] [dbo].[Dtm] NOT NULL, [_LastBedCd] [dbo].[Cd] NULL, [_LastPhysicianUid]

regex match body tag - help



I need regex code to get all content between body tag..

I search on all over the internet but those I find - not working!

example code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
   Example paragraph content
   <br />
  <h1>Header 1</h1>


Please help me.

Regex: password must contain one number, one letter, and 0 or more special chars


I'm trying to validate a password, and I'm almost there, but need some help finishing it off. Here's what I need:

1) 6-10 characters

2) At least one alpha AND one number

3) The following special chars are allowed (0 or more): !@#$%

Here's what I have:


Passwords that should work: test1ng, abc123, abc1234567, 123abc, abc!123, !@#$%1abcd, !@#$%a9

Passwords that shouldn't work: a, 1, a1, 1$, %, abc!@#, 012345, a1234+, abcde, test*ng, abcde!, !@#$%!, a1234567890, testit!0987, 1abcdefghij

It works on all my test cases, except it allows "a1234567890", "testit!0987", and "1abcdefghij", none of which should be allowed, since they contain more than 10 chars. What am I missing?

SSAS Excel Drill Thru : Number of Rows Returned don't match up


Hi, I have created an excel report which connects to my cube and have created drill thru action. When I double click on data cell in excel, what I would expect is to give details for that cell. For example, I have a cell in excel that represents 1000 Sales made. When I double click on it, it should only show me thousand rows, however for some reason it gives me more than 1000 rows. So basically the cell counts don't tie with drill thru row counts.....

Any idea on how I can rectify this?

what is the "." for in a phone number regex?

      string phone = "973 555-7241";
      string pat = @"^\d{3}[- .]?\d{3}[- .]?\d{4}$";
      Match rv = Regex.Match(phone, pat);

What does the "." in the section "[- .]" of the above regex pattern mean?

I understand "." to mean 'any char but newline". Square brackets contain a set of chars, any of which can match the current character. [ -] means "either space char or dash char".  I read "[- .]" to mean any of "dash, space or any char other than new line".  But something like 973x555-1212 does not match the regex.



Estimated number of rows does not always match actual number of rows


I am looking at some code that I am writing and keeping an eye out for performance, what i do notice is that on the for left of the query plan by the select/delete, if I place the mouse cursor on the arrow the actual number of rows hardly ever matches the actual number of rows.

Is there anything that I can do to resolve this, I do notice that one needs to update statistics or reorg/rebuild indexes but still the inconsistency exists. Is there a better explanation for this ?


how to use regex to identify the number of links in html source code


Hi, all, how to count the number of links in a piece of html source code, is it possible to use regex, for example, create a regex "href" and to count for matches? thanks in advance.

for example, a segment of html code like this:

<TD style="PADDING-RIGHT: 3px" width=150><A id=a588660 onclick="return Evar16_tracking('588660');" href="/products/shprodde.asp?sku=588940"><IMG style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc

regex.match seems to get hanged and also increases the CPU usage to 60-100%

regex.match seems to get hanged and makes the CPU usage to 60-100%. Is there any solution for this problem or any other workaround? please help ....!!!
 Public Sub OUT()
   Dim strPatternString, strRepeaterString As String
   Dim objRegex As Regex
   Dim objRegexMatch As Match

   strPatternString = "^(\\n)*(\s)*(?<OUTPart>((?<OUTGoingIdentifier>OUT)\\n\s*)(((?<OUTList>(?<OutgoingInfo>((?<ConfiguredDelimitersPattern>[/\.\.$/]{1,}))(((?<Type>[a-z][a-z0-9]{2})|(?<Type>[a-z]{3}))){0,1}((?<SerialNumber>[0-9]{5})|(?<SerialNumber>[a-z0-9][0-9]{3,4}))(((?<OwnerCode>[a-z0-9]{2}[a-z]{0,1})|(?<OwnerCode>[a-z0-9]{2}[a-z]{0,1})){0,1}){0,1}((/|(?<ConfiguredDelimitersPattern>[/\.\.$/]{1,}))(?<UnloadingCode>[a-z]{3})){0,1}((/|(?<ConfiguredDelimitersPattern>[/\.\.$/]{1,}))(?<ContentCode>[a-z]{1,2})[ ]*){0,1}){0,}\\n\s*)+)|((?<NilOutGoingDetail>(\.|(?<ConfiguredDelimitersPattern>[/\.\.$/]{1,}))N[\\n]*))))((SI )|($))"
   strRepeaterString = "OUT\n.PMC19415CV/MST/C.PMC16266CV/MST/C.PMC18111CV/MST/C\n.PMC16676CV/MST/C.PMC12800CV/MST/C.PMC19931CV/MST/C\n.PMC20327CV/MST/C.PMC13937CV/MST/C.PMC20041CV/MST/C\n.PMC15891CV/MST/C.PMC20505CV/MST/C.PMC12699123CV/MST/C\n"
   objRegex = New Regex(strPatternString, RegexOptions.IgnoreCase)

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.

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