Not without producing all the possible outcomes of a certain Grammar, some of which are infinite. This means it's not possible in the general case for finding a specific wanted grammar from a given input set. Even in your cases, you need to give every possible production of the Grammar (regular expression) in order to know exactly what regular expression you are happening to look for. For example the first set, there are several regular expressions that can match it, some of which could be:
abc[0-9][0-9][0-9]
abc[1-2][0-5][2-3]
abc[1-2][0-5][2-3]a*
abc\d*
abc\d+
abc\d+a*b*c*
...
And so on. That being said you could find a grammar that happens to match that sets conditions. One way is to simply brute-force the similarities and differences of each input item. So to do this with the second example:
The ab
part is the same for all of them so we start with ab
as the regexp. Then the next character can be a, b or c
so we can say (a|b|c)
. Then 1 or empty
three times. That would result in:
ab(a|b|c)(1|)(1|)(1|)
Which is a correct regular expression, but maybe not the one you wanted.