
There is nothing wrong with the engine. It is perfectly correct. But you have to be very specific how you explain what you want or your intentions will not be understood. ^ and $ are very important because they signify that the regex should start matching from the beginning of the string to the end. Which is why \d{10} and ^\d{10}$ work differently Given the following strings 1234567890 12345678901 123456789012 1234567890134 \d{10} will match all of them because it means look for strings that have 10 digits following each other. If you want it to find COMPLETE strings that with with 10 digits following each other use ^\d{10}$. This will only match the first string On Thu, Mar 4, 2010 at 9:58 AM, Simon Mbuthia <simon.mbuthia@gmail.com>wrote:
Thank Conrad... but I think the engine is the one that's wrong, coz what would then be the difference between ^\d{10} and ^\d{10,} ?
On 4 March 2010 00:27, Rad! <conradakunga@gmail.com> wrote:
The regex you have is right. But it is also wrong
\d{10} means a number with 10 digits. A number with eleven digits also has ten digits.
If you mean that you want a string with exactly ten digits the regex you want is this one
^\d{10}$
On Wed, Mar 3, 2010 at 3:08 PM, Ndungi Kyalo <ndungi@gmail.com> wrote:
Thats a handfull. Perl Regex (which I believe .NET implements) would be
/[0-9]{10}/ ... And to be absolutely sure : /[0-9]{10,10}/
Its also possible that the slight differences between these regex engines is the reason our good friend was pulling at his hairs.
-- Ndungi Kyalo biblia.kenya.or.ke
On Wed, Mar 3, 2010 at 11:44 AM, <ashok+skunkworks@parliaments.info<ashok%2Bskunkworks@parliaments.info>
wrote:
On Wed, Mar 3, 2010 at 2:23 PM, Simon Mbuthia <simon.mbuthia@gmail.com> wrote:
Never mind, I used if (!match.Success || txtAccountNum.Text.Length != 10) throw Exception else Endelea()
the posix regex for 10 digits looks like this : [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] _______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-- Everyone's days are numbered. It's called a calendar
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general