For many of you my question should be simple. I at least SQL and I want to use the table name regexp:
SELECT name, age1 to table1 using this expression I can get it right
pattern compute p = pattern (". * FROM \\ s + (. *?) ($ | \\ s + [where, , Start \\ s + with, order \\ s +, group \\ s + BY]), pattern .isable case; matcher result = p.metter (psqu); if (result.find ()) { LRetorno = result.group (1);} But, if the table is named in the name The name of the key (xyz.table1) is, so my expression brings everything. My question is ... what do I need to modify on this question to return the table name without the schema / owner?
Any help would be highly apreciated Regards
Raphael Moita
Maybe it Try this way
string data1 = "Selection name, whatever the age from Table 1"; String data 2 = "Selection name, schema by age. Qualified 1, whatever "; pattern = p \" Pattern.compile ("from \\ s + (?: \\ w + \\.) * (\\ w +) ($ | \\ s + [WHERE, JOIN, START With SS +, order \\ s by +, group \\ s +]], "Pattern.CASE_INSENSITIVE"; // Test Matter M = P. MATTURE (Data 1); while (m.find () ) System.out.println (m.group (1)); meters = p.matcher (data2); while (m.find ()) System.out.println (m.group (1)); Output:
table1 table1 edit
I realized that ($ | \\ s + [where, include, start, \\ s + with, order \\ s + BY, GROUP \\ s + BY]) does not work because it's in my Should be in the Put I should have done "whatever" after the table name and it was found anyway. It does not work like you because you will be [WHERE, JOIN, START \\ s With +, ORDER \\ s + BY, GROUP \\ s + BY] instead of (where | Zone | start \\s + with | ORDER \\ s + BY | GROUP \\ s + BY) . For example [abc] equals (a | B C), so it asks the regular expression engine to accept any character in that set, the word abc not
Improve your pattern. \\ s + (Where to Join | with | Starting by \\ s + | Order \\ s + | Group \\ s +)), "Pattern.CASE_INSENSITIVE";
Comments
Post a Comment