Hi Terry, > > ^(?i)(?!.*(abcdefghijklmn|abcdefghijklm|abcdefghijkl|abcdefghijk|abcdefghij|abcdefghi|abcdefgh|abcdefg|abcdef|abcde|abcd|bcdefghijklmno|cdefghijklmnop|defghijklmnopq|efghijklmnopqu|fghijklmnopqur|ghijklmnopqurs|hijklmnopqurst|ijklmnopqurstv|klmnopqurstvw|lmnopqurstvwx|mnopqurstvwxy|nopqurstvwxyz|1234|2345|3456|4567|5678|6789|aaaa|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh|iiii|jjjj|kkkk|llll|mmmmm|nnnnn|oooo|pppp|qqqq|uuuu|rrrr|ssss|tttt|uuuu|vvvv|wwww|xxxx|yyyy|zzzz|!!!!|""""|££££|\$\$\$\$|%%%%|\^\^\^\^|&&&&|\*\*\*\*|::::|;;;;|''''|@@@@|####|~~~~|,,,,<<<<|\.\.\.\.|>>>>|\/\/\/\/|\?\?\?\?|\\\\|1111|2222|3333|4444|5555|6666|7777|8888|9999|0000|Dorset|spring|summer|autumn|winter|monday|tuesday|wednesday|thursday|friday|saturday|sunday|january|february|march|april|may|june|july|august|september|october|november|december)|([a-z])\1{2}).*$ ... > My password consists of three words followed by a year and an > exclamation mark (no spaces) and I reckon that complies with the > above. Does anyone disagree?
It depends on the words. I've laid out the regexp in ‘verbose’ style to make it easier to see its structure. I've added line numbers for reference. 1 ^ 2 (?i) 3 (?! 4 .* ( 5 abcdefghijklmn | abcdefghijklm | abcdefghijkl | abcdefghijk | 6 abcdefghij | abcdefghi | abcdefgh | abcdefg | abcdef | 7 abcde | abcd | 8 bcdefghijklmno | 9 cdefghijklmnop | 10 defghijklmnopq | 11 efghijklmnopqu | 12 fghijklmnopqur | 13 ghijklmnopqurs | 14 hijklmnopqurst | 15 ijklmnopqurstv | 16 klmnopqurstvw | 17 lmnopqurstvwx | 18 mnopqurstvwxy | 19 nopqurstvwxyz | 20 1234 | 2345 | 3456 | 4567 | 5678 | 6789 | 21 aaaa | bbbb | cccc | dddd | eeee | ffff | gggg | hhhh | 22 iiii | jjjj | kkkk | llll | mmmmm | nnnnn | oooo | 23 pppp | qqqq | uuuu | rrrr | ssss | tttt | uuuu | vvvv | 24 wwww | xxxx | yyyy | zzzz | 25 !!!! | """" | ££££ | \$\$\$\$ | %%%% | \^\^\^\^ | &&&& | 26 \*\*\*\* | :::: | ;;;; | '''' | @@@@ | #### | ~~~~ | 27 ,,,,<<<< | \.\.\.\. | >>>> | \/\/\/\/ | \?\?\?\? | \\\\ | 28 1111 | 2222 | 3333 | 4444 | 5555 | 29 6666 | 7777 | 8888 | 9999 | 0000 | 30 Dorset | 31 spring | summer | autumn | winter | 32 monday | tuesday | wednesday | thursday | 33 friday | saturday | sunday | 34 january | february | march | april | may | june | 35 july | august | september | october | november | december 36 ) | 37 ([a-z])\1{2} 38 ) 39 .* 40 $ It's poorly written. Lines of interest: 1. Match start of the password. 2. Case insensitive from here on. 3. Do not match... 4. Zero or more characters, i.e. anything, followed by... 5-7. Four to fourteen characters from the start of the alphabet. 8-10. Fourteen characters sliding through the alphabet starting at ‘b’, ‘c’, and ‘d’ given line 5 has already covered starting with ‘a’. 11. Bug: ends with ‘u’ rather than ‘r’; someone with poor English who learnt that ‘q’ is always followed by ‘u’? 12-15. The ‘qu’ persists, with ‘tv’ appearing; ‘u’ has already handled. 16. Bug: starting with ‘j’ has been missed, shortening the match to thirteen characters. 17-19. The two bugs continue, ‘qu’ and thirteen long. 20. A run of four digits within 1-9; 0 is not tested, i.e. ‘0123’ and ‘7890’. 21-24. The same letter repeated four times. Bug: ‘u’ appears twice, after ‘q’ and ‘t’. 25-27. The same punctuation repeated four times. Bug: line 27 lacks a ‘|’, meaning ‘alternately’, in ‘,,,,<<<<’ so it matches those eight characters. Bug: various punctuation missed, e.g. ‘[’. 28-29. The same digit repeated four times. Bug: lines 21-29 could be written as ‘[[:print:]]{4}’ to cover all printing characters, including space. This still allows non-printing characters if they can be entered. 36. Alternately to lines 4-37... 37. Various letters followed twice by what matched the group starting on line 4. Bug: that could couldn't have matched else this alternative wouldn't be matching; the group could be started with ‘(?:’ so it isn't a capturing group. Which letters and whether accented versions are included depends on how Java will handle the locale; I don't know Java. Bug: the overall intent is unclear; perhaps two adjacent pairs, e.g. ‘4422’. 39. Anything. Bug: not needed given... 40. Match end of the password. Bug: can also be dropped along with line 39. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2024-11-12 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... https://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk