471,596 Members | 830 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

Is there any command in vb.net like the Inlist function of foxpro?

kd
Hi All,

I found the 'Inlist' function of foxpro very useful.

Is there any command in vb.net that does the same job?

Thanks.
kd
Nov 21 '05 #1
6 6696
"kd" <kd@discussions.microsoft.com> schrieb:
I found the 'Inlist' function of foxpro very useful.

Is there any command in vb.net that does the same job?


Jay B. Harlow [MVP - Outlook] posted a solution for strings some days ago:

<URL:http://groups.google.de/groups?selm=emuGXgdGFHA.1500%40TK2MSFTNGP09.phx.gb l>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Kd,
In addition to Herfried's link, I would suggest you review the "Complete
Thread" link in the header (of Herfried's link), as my other post in that
thread provided a number of alternatives.

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
Hi All,

I found the 'Inlist' function of foxpro very useful.

Is there any command in vb.net that does the same job?

Thanks.
kd

Nov 21 '05 #3
kd
Jay,

Reading through the complete thread has been helpful. Thanks.

I have one question; may sound elementary though.

What does this pattern mean to vb.net?
Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"

At runtime, pattern would hold the value
(^|\W+)(cat|dog|sleep)($|\W+)
which is passed to
System.Text.RegularExpressions.Regex.IsMatch
How does this pattern convey to IsMatch to look for whole words, instead of
searching for a part of the pattern? Does the pattern convey to Ismatch that
“|” is a delimiter?

Regards,
kd.
"Jay B. Harlow [MVP - Outlook]" wrote:
Kd,
In addition to Herfried's link, I would suggest you review the "Complete
Thread" link in the header (of Herfried's link), as my other post in that
thread provided a number of alternatives.

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
Hi All,

I found the 'Inlist' function of foxpro very useful.

Is there any command in vb.net that does the same job?

Thanks.
kd


Nov 21 '05 #4
kd,
What does this pattern mean to vb.net? The pattern itself is a special language the RegEx understands. It has a
number of operators that mean special things.

For example:
| is alternation
() are grouping
$ is end of line
^ is beginning of line
+ is one or more
\W is non-word characters
...

For a complete list & meanings of all the operators see the reference &
documentation links below.

NOTE: Rather then Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"
It appears you can reduce the expression to
Dim pattern As String = "(" & String.Join("|", words) & ")\b"
The \b specifies that the match must occur on a boundary between \w
(alphanumeric) & \W (nonalhpanumeric) characters.

The "Easiest" way to find out what it means is to use the Analyzer button in
Expresso or the Interpret button in RegEx Workbench (links below).

It says that it needs match the begging of the string or white space,
followed by one of the words, followed by end of the string or white space.
The begin or end of string can be a new line based on the options passed to
RegEx.

Expresso & RegEx Workbench both have wizards of varying degrees to help you
build your expression, plus they allow you to test your expressions, also
the analyzer/interpreter in each is rather handy.

Expresso:
http://www.ultrapico.com/Expresso.htm

RegEx Workbench:
http://www.gotdotnet.com/Community/U...-4ee2729d7322A

tutorial & reference on using regular expressions:
http://www.regular-expressions.info/

The MSDN's documentation on regular expressions:
http://msdn.microsoft.com/library/de...geElements.asp

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com... Jay,

Reading through the complete thread has been helpful. Thanks.

I have one question; may sound elementary though.

What does this pattern mean to vb.net?
Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"

At runtime, pattern would hold the value
(^|\W+)(cat|dog|sleep)($|\W+)
which is passed to
System.Text.RegularExpressions.Regex.IsMatch
How does this pattern convey to IsMatch to look for whole words, instead
of
searching for a part of the pattern? Does the pattern convey to Ismatch
that
"|" is a delimiter?

Regards,
kd.
"Jay B. Harlow [MVP - Outlook]" wrote:
Kd,
In addition to Herfried's link, I would suggest you review the "Complete
Thread" link in the header (of Herfried's link), as my other post in that
thread provided a number of alternatives.

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
> Hi All,
>
> I found the 'Inlist' function of foxpro very useful.
>
> Is there any command in vb.net that does the same job?
>
> Thanks.
> kd


Nov 21 '05 #5
kd,
What does this pattern mean to vb.net? The pattern itself is a special language the RegEx understands. It has a
number of operators that mean special things.

For example:
| is alternation
() are grouping
$ is end of line
^ is beginning of line
+ is one or more
\W is non-word characters
...

For a complete list & meanings of all the operators see the reference &
documentation links below.

NOTE: Rather then Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"
It appears you can reduce the expression to
Dim pattern As String = "(" & String.Join("|", words) & ")\b"
The \b specifies that the match must occur on a boundary between \w
(alphanumeric) & \W (nonalhpanumeric) characters.

The "Easiest" way to find out what it means is to use the Analyzer button in
Expresso or the Interpret button in RegEx Workbench (links below).

It says that it needs match the begging of the string or white space,
followed by one of the words, followed by end of the string or white space.
The begin or end of string can be a new line based on the options passed to
RegEx.

Expresso & RegEx Workbench both have wizards of varying degrees to help you
build your expression, plus they allow you to test your expressions, also
the analyzer/interpreter in each is rather handy.

Expresso:
http://www.ultrapico.com/Expresso.htm

RegEx Workbench:
http://www.gotdotnet.com/Community/U...-4ee2729d7322A

tutorial & reference on using regular expressions:
http://www.regular-expressions.info/

The MSDN's documentation on regular expressions:
http://msdn.microsoft.com/library/de...geElements.asp

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com... Jay,

Reading through the complete thread has been helpful. Thanks.

I have one question; may sound elementary though.

What does this pattern mean to vb.net?
Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"

At runtime, pattern would hold the value
(^|\W+)(cat|dog|sleep)($|\W+)
which is passed to
System.Text.RegularExpressions.Regex.IsMatch
How does this pattern convey to IsMatch to look for whole words, instead
of
searching for a part of the pattern? Does the pattern convey to Ismatch
that
"|" is a delimiter?

Regards,
kd.
"Jay B. Harlow [MVP - Outlook]" wrote:
Kd,
In addition to Herfried's link, I would suggest you review the "Complete
Thread" link in the header (of Herfried's link), as my other post in that
thread provided a number of alternatives.

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
> Hi All,
>
> I found the 'Inlist' function of foxpro very useful.
>
> Is there any command in vb.net that does the same job?
>
> Thanks.
> kd


Nov 21 '05 #6
kd
Thanks Jay for the great explanation.

Regards,
kd.

"Jay B. Harlow [MVP - Outlook]" wrote:
kd,
What does this pattern mean to vb.net?

The pattern itself is a special language the RegEx understands. It has a
number of operators that mean special things.

For example:
| is alternation
() are grouping
$ is end of line
^ is beginning of line
+ is one or more
\W is non-word characters
...

For a complete list & meanings of all the operators see the reference &
documentation links below.

NOTE: Rather then
Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"


It appears you can reduce the expression to
Dim pattern As String = "(" & String.Join("|", words) & ")\b"


The \b specifies that the match must occur on a boundary between \w
(alphanumeric) & \W (nonalhpanumeric) characters.

The "Easiest" way to find out what it means is to use the Analyzer button in
Expresso or the Interpret button in RegEx Workbench (links below).

It says that it needs match the begging of the string or white space,
followed by one of the words, followed by end of the string or white space.
The begin or end of string can be a new line based on the options passed to
RegEx.

Expresso & RegEx Workbench both have wizards of varying degrees to help you
build your expression, plus they allow you to test your expressions, also
the analyzer/interpreter in each is rather handy.

Expresso:
http://www.ultrapico.com/Expresso.htm

RegEx Workbench:
http://www.gotdotnet.com/Community/U...-4ee2729d7322A

tutorial & reference on using regular expressions:
http://www.regular-expressions.info/

The MSDN's documentation on regular expressions:
http://msdn.microsoft.com/library/de...geElements.asp

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
Jay,

Reading through the complete thread has been helpful. Thanks.

I have one question; may sound elementary though.

What does this pattern mean to vb.net?
Dim pattern As String = "(^|\W+)(" & String.Join("|", words) &
")($|\W+)"

At runtime, pattern would hold the value
(^|\W+)(cat|dog|sleep)($|\W+)
which is passed to
System.Text.RegularExpressions.Regex.IsMatch
How does this pattern convey to IsMatch to look for whole words, instead
of
searching for a part of the pattern? Does the pattern convey to Ismatch
that
"|" is a delimiter?

Regards,
kd.
"Jay B. Harlow [MVP - Outlook]" wrote:
Kd,
In addition to Herfried's link, I would suggest you review the "Complete
Thread" link in the header (of Herfried's link), as my other post in that
thread provided a number of alternatives.

Hope this helps
Jay

"kd" <kd@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
> Hi All,
>
> I found the 'Inlist' function of foxpro very useful.
>
> Is there any command in vb.net that does the same job?
>
> Thanks.
> kd


Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Simon Bailey | last post: by
8 posts views Thread by Alfred | last post: by
2 posts views Thread by Amedee Van Gasse | last post: by
5 posts views Thread by ABC | last post: by
2 posts views Thread by Toco | last post: by
4 posts views Thread by Robert Hooker | last post: by
7 posts views Thread by z71mdridin | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.