|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Magnus Bäck (magnus
dsek.lth.se)
Date: Wed Jun 03 2009 - 01:46:15 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, June 3, 2009 8:28 am, Kammen van, Marco, Springer SBM NL said:
> One of our users is requesting a batch of e-mail aliases ranging from:
>
> J10001
domain.com to j10300
domain.com
>
> I made the following regexp which kind of does the trick:
>
> /j10[0-3][0-9][0-9]\
domain\.com/ thisaddress
domain.com
>
> But this adds the range of j10300 to j10399 which isn't wanted.
> So I tried the following regexp:
>
> /j(10001..10300)\
domain\.com/ thisaddress
domain.com
>
> But that's not working....
Indeed, since ranges like that simply are not supported in regular
expressions. This should work:
/^j10([0-2][0-9][0-9]|300)
example\.com$/ thisaddress
example.com
Note:
* This expression still matches j10000
example.com even though the
sequence should start at 10001. I can't find a trivial way of
accomplishing such an expression without it getting pretty complex.
If that's an important requirement, consider just generating a static
list. No need to use too complex regexps for strings that can be
enumerated trivially.
* Initial ^ added.
* Final $ added.
* Unnecessary escape character preceding the
removed.
* Using example.com as example domain rather than domain.com.
--
Magnus Bäck
magnus
dsek.lth.se
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]