0

I'm learning how to use a SQL database and we recently got to talking about regular expressions and one of the problems my professor gave me was to "give two examples that match the pattern ab{2,4}de."

But my problem is that I'm not sure what ab{2,4}de means in terms of regular expressions, since the question is talking about patterns I'm assuming I have to use REGEXP_SUBSTR in my expression, I'm pretty sure that the {2,4} part means that the source characters have to be at least 2 characters but no more than 4 characters long, but the ab and de parts have got me stumped.

So in short I'm not asking for an answer for my homework just an explanation of what "ab{2,4}de" means, any help will be appreciated!

1 Answers1

1

This expression consists of 4 characters as:

  • a
  • b occurring 2-4 times
  • d
  • e

All in that order with no separation. The pattern is not anchored anywhere in the string, so any of these match:

abbde
xyzabbbbde
aaaabbbdeeeee
Gordon Linoff
  • 1,122,135
  • 50
  • 484
  • 624