I have this table
And I am using the following code to retrieve data from my table that returns all the English words that its Kurdish word contains بةرز
targetText="بةرز";
try (PreparedStatement ps = conn.prepareStatement(
"SELECT English,Kurdish FROM Info " +
"WHERE Kurdish = ? " +
"OR REGEXP_MATCHES(Kurdish, ?) " +
"OR REGEXP_MATCHES(Kurdish, ?) " +
"OR REGEXP_MATCHES(Kurdish, ?) ")) {
ps.setString(1, targetText);
ps.setString(2, "^[. ]*" + targetText+ "[ ]*[:،,]+[ .]*$");
ps.setString(3, "^[. ]*[:،,]+[ ]*" + targetText+ "[. ]*$");
ps.setString(4, "^[. ]*[:،,]+[ ]*" + targetText+ "[ ]*[:،,]+[ .]*$");
try (ResultSet rSet = ps.executeQuery()) {
while (rSet.next()) {
System.out.println(rSet.getString("English"));
System.out.println(rSet.getString("Kurdish"));
}
}
}
So it works fine, it prints all the English words that I want.
My problem is that when I get the corresponded Kurdish word it doesn't print the complete cell. It just prints بةرز,
For example the output of the previous code should be:
aesthete
بةرز ، جوانىثةرست
aether
زوَر ناسك ، بةرز ، ثيروَز ، ئاسمانى
affair
بةرز
But it prints
aesthete
بةرز
aether
بةرز
affair
بةرز
What can I do to get the output that I want?
Note that I am using UCanAccess
for my database connection,
You can go to a specific record in Access when you know which record you want to find. The Go to box lets you choose a particular record from a drop-down list and is usually added to forms. To navigate to a specific record, click the arrow to the right of the Go to box, and then select a record from the drop-down list.
On the Home tab, in the Find group, click Find. The Find and Replace dialog box appears, with the Find tab selected. In the Find What box, type the value for which you want to search. To change the field that you want to search or to search the entire underlying table, click the appropriate option in the Look In list.
To export data from Access, first select the table or other database object to export in the Navigation Pane. Then click the “External Data” tab in the Ribbon. Then click the button in the “Export” button group for the file format to which to export the object.
Another way to access the selection filter options is to right-click the specific cell. For example, if the value 2/21/1967 is currently selected in the BirthDate field, on the Home tab, in the Sort & Filter group, click Selection to display the filter by selection commands, and then select your filtering option..
Tanks for all, I have solved it just with a few change within the regx
targetText="بةرز";
try (PreparedStatement ps = conn.prepareStatement(
"SELECT English,Kurdish FROM Info " +
"WHERE Kurdish = ? " +
"OR REGEXP_MATCHES(Kurdish, ?) " +
"OR REGEXP_MATCHES(Kurdish, ?) " +
"OR REGEXP_MATCHES(Kurdish, ?) ")) {
ps.setString(1, targetText);
ps.setString(2, "^" + targetText+ "[ ]*(،)[.]*");
ps.setString(3, "[.]*(،)[ ]*" + targetText+ "$");
ps.setString(4, "[.]*(،)[ ]*" + targetText+ "[ ]*(،)[.]*");
try (ResultSet rSet = ps.executeQuery()) {
while (rSet.next()) {
System.out.println(rSet.getString("English"));
System.out.println(rSet.getString("Kurdish"));
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With