Sometimes you don't want the reverse engineering tool to extract all of the tables in your database. For example, the database may contain technical tables which are logically are not part of the model. This is when the -regexp option comes in handy.
Use the -regexp option and the tool will extract all tables and views with names matching the regular expression. The tool prints the regular expression it uses so you can verify that your shell parsed the expression correctly. For this option to work, the regular expression has to be in the Java syntax. For those unfamiliar with Java syntax, below is a little guide.
Java regular expressions guide
. | Matches any character |
^regex | Finds regex that must match at the beginning of the line. |
regex$ | Finds regex that must match at the end of the line. |
[abc] | Set definition, can match the letter a or b or c. |
[abc][vz] | Set definition, can match a or b or c followed by either v or z. |
[^abc] | When a caret appears as the first character inside square brackets, it negates the pattern. This can match any character except a or b or c. |
[a-d] | Ranges: matches a letter between a and d. |
X|Z | Finds X or Z. |
XZ | Finds X directly followed by Z. |
\d | A digit: [0-9] |
\D | A non-digit: [^0-9] |
Quantifiers
* | Match 0 or more times |
+ | Match 1 or more times |
? | Match 1 or 0 times |
{n} | Match exactly n times |
{n,} | Match at least n times |
{n,m} | Match at least n but no more than m times |
Negation
^(?!regex).* | Match strings not matching the regex |
Examples
a.* | Words starting with a |
[abc].* | Words starting with a, b or c |
.*_price | Words ending with _price |
a.*|.*a | Words starting with a or ending with a |
.*\d.* | Words containing a digit |