lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 02/23/2017 03:44 PM, Coda Highland wrote:
>>   Check that given string in lowercase contains no more than one entry
>>   of alphabet character.
>>
>>   (so all permutations of subset of alphabet [a-z] should be matched)
> 
> Not hard at all. If you support backreferences in pattern strings
> (common feature) then it's just /([a-z]).*\1/. If you don't, then it's
> more verbose, but it's just /(a.*a|b.*b|c.*c| --(snip)-- |y.*y|z.*z)/.
> 
>> Another example:
>>
>>   Check that given string in lowercase contains all symbols of
>>   predefined alphabet. Ignore spaces.
>>
>>   (so "the quick brown fox jumps over the lazy dog" should match)
> 
> Also quite tractable, using lookahead: /(?=.*a)(?=.*b) --(snip)-- (?=.*z)/.

Thank you for reply!

I didn't know about this regexp language. In what programming languages
it used (or what is the name of this regexp language itself)?

Also how /(a.*a|b.*b)/ is treated? (Let's assume two-character alphabet
{'a', 'b'} and string "abab" for which we shouldn't get a match). At
first glance this looking like "match('a', any_chars, 'a') or
match('b', any_chars, 'b')".

-- Martin