Does the teacher also forbid using '+' to replace the asterisks inside of the match expression??
This some other ways, but not capturing the last '.' to be the filename, since it starts the extension.
These are exactly like OriginalGriff is describing, so its just something to experiment with...
^(ABC_A_.+)\.[^.]{3,4}$
^(ABC_A_.{1,})\.[^.]{3,4}$
^(ABC_A_.{1,})\.[a-z]{3,4}$
^(ABC_A_.{1,})\.(?i)[a-z]{3,4}$
^(ABC_A_.{1,})\.(?i)[\w]{3,4}$
If only needing to conduct filenames with exactly two '.' they could look like...
^(ABC_A_[^.]+)\.[^.]+\.[^.]{3,4}$
^(ABC_A_[^.]{1,})\.[^.]+\.[^.]{3,4}$
^(ABC_A_[^.]{1,})\.[^.]+\.[a-z]{3,4}$
^(ABC_A_[^.]{1,})\.[^.]+\.(?i)[a-z]{3,4}$
^(ABC_A_[^.]{1,})\.[^.]+\.(?i)[\w]{1,5}$
These do look more complicated, but its just replacing . with [^.] and then using [^.]+\. just before the extension.
You could change {1,} into {0,} but if he wont grant using the asterisks, Im thinking he will also not like this either.
This one is for filenames like in the example, but its making -1 optional, and granting 3-or-4 letter extensions.
^(ABC_A_[^.]+\.\d+(-\d)?)\.[a-zA-Z]{3,4}$
This why OriginalGriff is saying to define what is 'legal' with examples, because otherwise its much guessing.
Our teacher does also discourage using .* whenever .+ can match all of the samples, and its a 2-point deduction.
So one time I was being sneaky and did use .{0,} instead, but then he just gives me the deduction anyway!
Not really - the asterix in a regex means "zero or more repetitions of" so unless you know how many to expect (and can use "{}" syntax instead), or there will be a minimum of one character (in which case you can use "+" instead) you probably need to repeat things to get a working match.
Start by defining exactly what you are trying to match: what is "legal" and what isn't with examples, and remember that "." is a special character in a Regex which matches any other single character - so any filename which much have at least two "dots" will probably need both of them escaped to get a match.
Get a copy of Expresso[^] - it's free, and it examines, tests, and generates Regular expressions.