Jump to content
toufik

search string word by word in table field

Recommended Posts

hello every one how you all doing ,,,i'm looking for advanced search method

wait what ?!!!! ^^^

so i need to search a long text word by word and move to the next one in onther long text in a table field and come back with a result of any match ,,,

is that all .....no ,,, we want to highlight that word ,,,easy right and move to the next one

i found a paid composant called Rubicon

the picture show more detail about it please take a look thanks

Untitled.png

Share this post


Link to post

Hi, the first thing you have to give us is : Database ? Your message is partly incomprehensible  without this info.

I think you are searching the word regular expressions   unit system.regularexpressions

 

find "green" within 4 of "egg" you can translate by an expression, something like this one  

(?i-msn-x:).*/sgreen/s.{4}/segg/s.*

image.thumb.png.7a79015e1820736f9aaddb17d4f18e24.png  Expresso Screenshot

 

NB. I don't understand this story about Rubicon.

 

1- Considering you use Firedac ?

2- Database :

   - SQLite ? If so you can, let say, "append" functions to the database  (see Extending SQLite Engine Custom Functions Chapter and then your function can use regexpressions  

   - Firebird ? regular expressions can be used using SIMILAR TO

  • Like 1

Share this post


Link to post

Hello every one , and thank you all for taking a  time to try to understand what i have asked ,,,, 
this is a video show exactly what i need and sorry for not replying sooner ,, i have a bit problem in my windows i lost all files and did have try to fix ,, all fine now .
@Serge_G yes I'm working with SQLite db and firedac 
like i said before this video show  what i need to do ,, its paid Component called Rubicon.

Share this post


Link to post

Hi,

 

Firedac and SQLite. Ok.

You can read this (french) blog post https://www.developpez.net/forums/blogs/138527-sergiomaster/b9985/firedac-sqlite-ajout-fonctions/ to know how to add a TFDSQLiteFunction  (english video included)

 

SQlite function should be something like 
 

procedure TForm131.SimilarToCalculate(AFunc: TSQLiteFunctionInstance;
  AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject);
var Match: TMatch;
begin
  Match := TRegEx.Match(AInputs[0].AsString, AInputs[1].AsString);
  if Match.Success then Aoutput.Asboolean:=true
                   else AOutput.AsBoolean:=False;
end;

 

Query like (for your demand)

SELECT * FROM MYTABLE WHERE SIMILAR(RecipeTitel,'(?i-msn-x).*/sgreen/s.{4}/segg/s.*)=1

Here is a little demo

Now it's up to you to create 'good' expressions :classic_biggrin:

Edited by Serge_G
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×