'a1b' matchesRegex: '[[:alnum:]]*((\d+[[:alnum:]]*[[:alpha:]]+)|([[:alpha:]]+[[:alnum:]]*\d+))[[:alnum:]]*'. perhaps? Regards, Gary ----- Original Message ----- From: "Stéphane Ducasse" <stephane.ducasse@inria.fr> To: <Pharo-project@lists.gforge.inria.fr> Sent: Sunday, February 12, 2012 2:40 PM Subject: Re: [Pharo-project] Regular expression thanks for the update. Now may be the problem can be still express with regex. Stef On Feb 12, 2012, at 10:49 AM, Lukas Renggli wrote:
VB-Regexp does not support any of the following common regular expression features: lookahead, lookbehind, recursion, multiplicity ranges, non-greedy quantifier, shy groups, directives, conditionals, named captures, back references, and comments.
You can (conceptually) do all this with PetitParser, but then you are not writing a regular expression anymore but a (PEG) parser.
There was once a plugin that called an external regular expression library (I think it used the library Perl is using) that supported the features you are looking for.
Lukas
On 11 February 2012 23:27, <recursive68@gmail.com> wrote:
Hi,
Is it possible to use the VB-Regexp package to construct a single regular expression that ensures a string is alphanumeric and contains both at least one number and alphabetic character.
Looking at the regexp package and documentation it doesn't appear so. In javascript or perl you use something like this with lookahead assertions:
^(?=.*[a-zA-Z])(?=.*[0-9]).*$
I have something working using multiple regexp's but wondered if a more typical regexp was possible using the package ?
Thanks
-- Lukas Renggli www.lukas-renggli.ch