0

Is it possible to search an SQL database by an entry's format?

I'm specifically trying to find instances in a database where the structure of an entry is A##.# (Any letter, followed by 2 numbers, a decimal, then a final number)

And in case it could cause complications or may need separate attention, would the same code be able to find instances where there is no decimal, just A##?

  • Which [DBMS](https://en.wikipedia.org/wiki/DBMS) are you using? Postgres? Oracle? –  Jun 20 '17 at 14:14
  • @RobertMcKee not just `A` any letter so maybe `[a-zA-Z]` instead of just A? but is ASCII dependent. (https://stackoverflow.com/questions/3617797/regex-to-match-only-letters) – xQbert Jun 20 '17 at 14:19
  • @RobertMcKee: that is invalid standard SQL. The only wildcards that SQL supports for the LIKE operator are `_` (single character) and `%` (multiple characters) –  Jun 20 '17 at 14:27
  • @RobertMcKee: no, it will **not** work with Postgres (I think SQL Server is the only DBMS that uses an extension to the `LIKE` syntax - all other provide real regular expression operators) –  Jun 20 '17 at 17:59

0 Answers0