232
votes

I'm processing a bunch of tables using this program, but I need to ignore ones that start with the label "tbd_". So far I have something like [^tbd_] but that simply not match those characters.

1
How does SchemaSpy work? Are you passing it a list of table names or are you passing it a regex and it's doing the matching? - Mark Biek
I'm passing a regex (it's the -i flag) and it'll import the matches, or so it says in any case =) - echoblaze
@echoblaze: If you’re processing XML, why don’t you use an XML parser? That would be much easier than using regular expressions. - Gumbo

1 Answers

385
votes

You could use a negative look-ahead assertion:

^(?!tbd_).+

Or a negative look-behind assertion:

(^.{1,3}$|^.{4}(?<!tbd_).*)

Or just plain old character sets and alternations:

^([^t]|t($|[^b]|b($|[^d]|d($|[^_])))).*