本文介绍了使用ASP进行关键字解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ASP(VBScript)中编写一个搜索程序。用户可以输入关键字

并按提交。

用户可以用空格和/或逗号分隔关键字,关键词可以

包含简单的单词,单引号的字符串(短语),双引号的字符串

(短语)。

例如:


关键词:


Jack,Jill,Jim,Timothy Brown,Mary或

Jack Jill Jim''Timothy Brown''Mary OR

Jack,Jill Jim,''Timothy Brown''" Mary"


当我解析它时,我将关键字存储在一个数组中。结果必须是:


Jack

Jill

Jim

Timothy Brown

Mary


我尝试过使用Split这样做,但我无法获得短语。一些

建议,代码示例或链接会有所帮助。


提前致谢


ARK。

I am writing a search program in ASP(VBScript). The user can enter keywords
and press submit.
The user can separate the keywords by spaces and/or commas and key words may
contain plain words, single quoted strings (phrases), double quoted strings
(phrases).
For example:

Keywords:

Jack, Jill, Jim, "Timothy Brown", Mary OR
Jack Jill Jim ''Timothy Brown'' Mary OR
Jack, Jill Jim, ''Timothy Brown'' "Mary"

When I parse it i store the keywords in an array. The results must be:

Jack
Jill
Jim
Timothy Brown
Mary

I have tried doing this using Split but am unable to get the Phrases. Some
suggestions, code examples or links would help.

Thanks in advance

ARK.

推荐答案







这可以无限制地获得复杂,例如,b $ b鲍勃,玛丽,蒂莫西,布朗 ''franke,'tom,hula hoop" mea,culpa"


你永远不知道用户将要输入什么,并且编写代码很难

完全理解他们的意思。


我真的很想知道Google的解析算法是如何工作的。我没有勇气做到这一点:支持所有单词,任何

单词或精确短语......但不包含三者的组合。



This can get infinitely complex, e.g.

Bob, Mary, "Timothy, Brown" ''franke, "tom, hula hoop" mea, culpa"

You never know what a user is going to enter, and it''s hard to write code to
understand exactly what they mean.

I''d be really interested to see how Google''s parsing algorithm works. I
wasn''t brave enough to do that: www.aspfaq.com supports all words, any
words, or exact phrase... but no combination of the three.


这篇关于使用ASP进行关键字解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 08:34