realbasic-nug.it
[Top] [All Lists]

Problema col RegEx (penso)

To: REALbasic NUG Italian <realbasic-nug dot it at lists dot realsoftware dot com>
Subject: Problema col RegEx (penso)
From: Luca Infante <l dot infante at poc dot it>
Date: Mon, 9 Jan 2006 19:48:36 +0100
Delivered-to: realbasic-nug dot it at lists dot realsoftware dot com
References: <64B74848-8D1A-44FD-ABB4-58A2F1EDC7C8 at tin dot it> <0E5E5DB4-A9EC-46EA-AE09-32E5F0517D2B at yahoo dot it> <E3D4AE2A-B8FD-4D35-BFD2-644D3261779C at tin dot it>
Spero di non fare un quesito banale ma sarà per la incaz... dell'esame che non ho passato ma non riesco ad arrivare ad una soluzione.

Spiegazione:

Il database è creato dal plugin di Valentina versione 1.11.
Quando legge i valori da inserire nel database lo fa con encodings. macroman. Se provo utf8 non mi carica tutti i dati.

Il programma è in RB 2005.

Il problema si crea nel metodo trova.
In pratica il cerca va in loop continuo se cerco nel database la parola "caffè" mentre funziona se cerco "caffe".
Qual è il problema?
Il cerca si avvale del RegEx ed è un metodo che fu scritto in RB 4.5 (dal precedente programmatore).

Ciao e Grazie Luca

Il metodo in questione (penso che l'errore sia qui non so se possa dipendere da passi precedenti):

Il metodo si chiama FindAllMatches.

La s passata viene presa da un editfield, quindi se non erro dovrebbe essere in UTF8. Giusto?

FindAllMatches re As RegEx, s As String, start As Integer, matches() As RegExMatch

  Dim pos As Integer
  Dim tmp As RegExMatch

  redim matches(-1)
  pos=start

  Do
    tmp=re.Search(s, pos)
    If tmp<>Nil Then
      matches.Append tmp
      pos=tmp.SubExpressionStartB(0)+Len(tmp.SubExpressionString(0))
    End if
  Loop Until tmp=Nil


<Prev in Thread] Current Thread [Next in Thread>