Salve,
sto cercando di creare una funzione glossario in ASP. Mi spiego meglio. Da un testo, memorizzato in una stringa, vorrei linkare alcune parole confrontandole con quelle presenti in una tabella (glossario) formata dai campi "ID", "lemma" e "definizione".
Esistono funzioni eleganti in ASP per fare questa operazione?
Grazie mille.

Io un tempo facevo con queste tre funzioni, ma magari esiste un sistema più elegante:
codice:
'######################################################################
'########  Funzione inserire il link al glossario in un testo  ########
'######################################################################

Function SostituisciGlossario(strMatchPattern, strPhrase)
   'create variables
    Dim objRegEx, Match, Matches, StrReturnStr
    'create instance of RegExp object
    Set objRegEx = New RegExp 

    'find all matches
    objRegEx.Global = True
    'set case insensitive
    objRegEx.IgnoreCase = True
    'set the pattern
    objRegEx.Pattern = strMatchPattern 

    'create the collection of matches
    Set Matches = objRegEx.Execute(strPhrase) 

    'print out all matches
    For Each Match in Matches
		Parola = Mid(strPhrase, Match.FirstIndex+1, Len(strMatchPattern))
		If Match.FirstIndex = 1 Then
			blnPrima = True 'sono all'inizio della frase per cui mi va bene fare la sostituzione
		Else 'altrimenti devo vedere il carattere precedente cos'è
			ChrPrecedente = Mid(strPhrase, Match.FirstIndex, 1)
			If (Asc(ChrPrecedente) >= 97 And Asc(ChrPrecedente) <= 122) Or (Asc(ChrPrecedente) >= 65 And Asc(ChrPrecedente) <= 90) Then
				'in questo caso il carattere precedente è una lettera per cui non va bene che lo evidenzi
				blnPrima = False
			Else
				blnPrima = True
			End If
		End If
		If Match.FirstIndex = Len(strPhrase) Then
			blnDopo = True 'vuol dire che è alla fine
		Else
			ChrSuccessivo = Mid(strPhrase, Match.FirstIndex + 1 + Len(Match.value) , 1)
			If Len(ChrSuccessivo) > 0 Then
				If (Asc(ChrSuccessivo) >= 97 And Asc(ChrSuccessivo) <= 122) Or (Asc(ChrSuccessivo) >= 65 And Asc(ChrSuccessivo) <= 90) Then
					'il carattere successivo è una lettera, per cui non va bene
					blnDopo = False
				Else
					blnDopo = True
				End If
			Else
				blnDopo = True
			End If
		End If
		If blnPrima = True And blnDopo = True Then
			SostituisciGlossario = "" & Parola & ""
		Else
			SostituisciGlossario = Parola
		End If
    Next

End Function

'######################################################################
'############### Ricava l'ID del lemma dalla parola   #################
'######################################################################
Function FindLemma(Lemma)
	If Not Lemma = "" Then
		Dim objRSLemma, strSQL
		Set objRSLemma = Server.CreateObject("ADODB.Recordset")
		strSQL = "SELECT ID " &_
					"FROM Glossario " &_
					"WHERE Lemma = '" & Lemma & "'"
		objRSLemma.Open strSQL, objConn, 3, 3
		If Not objRSLemma.EOF Then
			FindLemma = objRSLemma("ID")
		End If
		objRSLemma.Close
		Set objRSLemma = Nothing
	End If
End Function

'######################################################################
'############### Vera funzione glossario              #################
'######################################################################
Function Glossario(Testo)
	If Not Testo = "" Then
		Dim objRSG, strSQL
		Set objRSG = Server.CreateObject("ADODB.Recordset")
		strSQL = "SELECT ID, Lemma " &_
					"FROM Glossario"
		objRSG.Open strSQL, objConn
		If Not objRSG.EOF Then
			Do While Not objRSG.EOF
					Testo = Replace(Testo, objRSG("Titolo"), SostituisciGlossario(objRSG("Titolo"), Testo), 1, 1000, 1)
					Glossario = Testo
				objRSG.MoveNext
			Loop
		End If
		objRSG.Close
		Set objRSG = Nothing
	End If
End Function