Print Page | Close Window

Pattern matching in ASP

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=24271
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Pattern matching in ASP
Posted By: neotrix
Subject: Pattern matching in ASP
Date Posted: 27 August 2007 at 12:06pm
Salam-o-Aalikum,

I am working on a chat bot, I have its Perl version but since I do not have any Perl base so I am having very much difficulty translating its code into ASP. However, I think what I am wanting might already be done by somebody.

What I want to do is, that I will have a text file with all the patterns of questions and their according replies. I want to define the question pattern in this way:

What do you (think|say|suggest) I should try for (dinner|breakfast|lunch) (today|in the evening)

I want to match the pattern, for instance if somebody writes "What do you say i should try for dinner today", then I want this to recognize it.

I do have a solution to this in my mind, but that is going to make the script too very slow! My idea is to loop through the string (which the user has entered) and find out all the parentheses and select first word from the first bracket and first word from the second and match it with all the words in the last bracket. Then take second word from the first bracket, first word from the second and match with all the words in the third.

But this procedure is going to make the reply very slow. Because this is just one reply, it might have more words in it, and the total number of replies could be a hundred thousand. So one loop will have to go at least 200 times just matching one answer. And Multiply that with hundred thousand.. well.. I don't think its a good way to do it.

Please enlighten me. I am very confused.
Asalam-o-Aalikum.


-------------
http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net