How to get every words in textbox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pilakikalender
    New Member
    • Mar 2008
    • 2

    How to get every words in textbox?

    Hi,
    i want to get every words in textbox in VB.NET. i can compute the number of words in textbox:

    Dim x As Integer = System.Text.Reg ularExpressions .Regex.Matches( textbox1.Text, "\w+").Coun t()

    how can i get words?
    thanks...
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    ...
    It would appear that:
    System.Text.Reg ularExpressions .Regex.Matches( textb ox1.Text, "\w+")
    is returning some sort of collection/array of all the words.
    You are just taking the .Count() of that collection to get the number of them.

    Check MSDN for info on System.Text.Reg ularExpressions .Regex.Matches( ).

    Comment

    • pilakikalender
      New Member
      • Mar 2008
      • 2

      #3
      Originally posted by Plater
      ...
      It would appear that:
      System.Text.Reg ularExpressions .Regex.Matches( textb ox1.Text, "\w+")
      is returning some sort of collection/array of all the words.
      You are just taking the .Count() of that collection to get the number of them.

      Check MSDN for info on System.Text.Reg ularExpressions .Regex.Matches( ).
      You are right! i found the solution as you showed.

      Dim x As String = System.Text.Reg ularExpressions .Regex.Matches( txt_aranilanKel ime.Text, "\w+").Item(0). Value

      it shows me first word. this is what i want exactly.

      Thank you.

      Comment

      Working...