Click here to Skip to main content
13,044,543 members (60,221 online)
Rate this:
Please Sign up or sign in to vote.
See more:

In the above regex i want to exclude the 18 and 19 how can i do so
Posted 20-Feb-13 19:46pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Simple: don't use a regex.
Regexs are for pattern matching in strings - you can already see that your regex is getting nasty and difficult to work with. Do string matching in the regex, then use code to convert matched numbers and check them there.

Regexes are wonderful tools - but only when they are used on appropriate tasks.

If you must use a regex, then just take out the "18|19|" part of the match string. But seriously, I'd use code here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100