Why does my RegExp match in RegExr, but not in Python?

Because you should replace match with search.

match tries to match the string from the beginning, and \"O1533_FOO\" INTEGER NOT NULL , doesn’t begin with something that matches [A-Z], hence it fails.

See search() vs. match():

Python offers two different primitive operations based on regular expressions: re.match() checks for a match only at the beginning of the string, while re.search() checks for a match anywhere in the string (this is what Perl does by default).

Read more here: Source link