Re: Regular Expression Help
From: Karl (_at_)
Date: 09/24/04
- Next message: Karl: "Re: filtering out % sign input"
- Previous message: bruce barker: "Re: Plug-in arhitecture"
- In reply to: tmeister: "Re: Regular Expression Help"
- Next in thread: tmeister: "Re: Regular Expression Help"
- Reply: tmeister: "Re: Regular Expression Help"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 23 Sep 2004 20:24:42 -0400
Just so I'm clear, you want to limit on a certain character...such as 10 'a'
or more and it fails..but not necessarily in a row...so like
abaaaaacasaaaaaadasdsa would fail 'cuz in the totallity of the string there
are more than 10 'a'?
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ "tmeister" <tmeister@discussions.microsoft.com> wrote in message news:6C44F1C1-E097-449B-914F-BC306D9A57A1@microsoft.com... > Part of the problem is that I have a web application that builds forms > dynamically. I then allow for validation routines for the given controls. > For validation the system allows for multiple regular expressions for each > control if needed and the form. When someone posts their data I loop through > all of the controls and then pull their specific validation requirements from > the database. > > Let me know if you know what the regular expression would be to limit X > number of characters in a string. > > Thanks > > "Karl" wrote: > > > Todd, > > I'm almost positive you'll be better off going ToCharArray() and looping > > through the char array....something like: > > > > public static bool HasTooManyOfASingleCharacter(string source, char > > character, int max) { > > char[] array = source.ToCharArray(); > > int count = 0; > > for (int i = 0; i < array.Length; ++i ){ > > char c = array[i]; > > if (c == character){ > > ++count; > > if (count > max){ > > return true; > > } > > } > > } > > return false; > > } > > > > > > -- > > MY ASP.Net tutorials > > http://www.openmymind.net/ > > > > > > "tmeister" <tmeister@discussions.microsoft.com> wrote in message > > news:2F281AEA-4CD7-4762-BFCB-5F704BE88463@microsoft.com... > > > I am in need of a regular expression that tests and fails if there are 14 > > or > > > more of a character in the test string. There can be up to 13 of these > > > characters in the string and any other characters, but at the 14th of this > > > character it should fail. > > > > > > Thanks, > > > > > > Todd Meister > > > > > >
- Next message: Karl: "Re: filtering out % sign input"
- Previous message: bruce barker: "Re: Plug-in arhitecture"
- In reply to: tmeister: "Re: Regular Expression Help"
- Next in thread: tmeister: "Re: Regular Expression Help"
- Reply: tmeister: "Re: Regular Expression Help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading