in reply to My regex works, but I want to make sure it's not blind luck
Put it in a test script. Try it against edge cases (unusual test strings that might work when they shouldn't, or might not work when they should). For example:
use strict; use warnings; my @tests = ( ".", "", "A sentence.", ".gitignore", "word.doc", "a.dotted.name", ); print /^.*(\..*)$/ ? "Matched '$1' in " : "Failed", " '$_'\n" for @tes +ts;
Prints:
Matched '.' in '.' Failed '' Matched '.' in 'A sentence.' Matched '.gitignore' in '.gitignore' Matched '.doc' in 'word.doc' Matched '.name' in 'a.dotted.name'
|
|---|