????? ??????? ??????? ????? ?? Microsoft Visual Basic 6.0

?????? ????????? ?????? ?????????
???? ???????: 818802 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ??? ????? ????? ????????? ??????? ?????? ??????? ??????? ????? ?????? ?????? ??????? ???? ?????. ????????? ??????? ???? ????? ????? ?????? ??????? ????? ?????. ??? ??? ?????? ???????? ???? ????? ?? ????? Microsoft VBScript ?????? ????????? 5.5 ????? ?????? ????? ????? ??? ????? ??????? ??? ????? ?????? ???? ?? ??????? ????? ??? ?? ??????? ???????. ???? ??? ??????? ????? ????? ??? ????? ????? ???? ????? ??? ?????? ?????? ?? ??? ???.



???????


???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ?????:
  • Microsoft Visual Basic 6.0
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • Visual Basic 6.0
  • ???? ???? ????? ????


??????? ??????? ????? ??????? ??? ?????



?? Visual Basic 6.0 ?????? ?????? RegExp ????????? ??????? ??????? ???. ??? ????? ??????? ??????? ?? ??? RegExp. ????? ??? ??????? ??? ?????? ??????? ???? ??? ??????? ??? ???? RegExp:
  • ???: ????? ???? ???? ????? ????.
  • IgnoreCase: ????? ?????? ???? ???? ??? ?? ??? ??? ??? ???? ?????? ??????? ?????? ?? ???? ????????? ???????? ?? ?????.
  • ???? ?????: ????? ???? ?????? ?? ????? ???? ????? ???? ??? ?? ??? ??? ??? ?? ?????? ?? ??? ???? ???? ?????? ?? ????? ??? ??????? ?? ?? ??? ??? ??? ?? ?????? ?? ??? ??????? ????? ???.
???? RegExp ????? ??????? ?????? ?? ??? ???? ????? ????? ??? ????? ?? ??????? ??????:
  • ??????: ????? ???? ?????? ???? ???? ??? ?? ??? ??? ??????? ?????? ???? ????? ??????? ???????.
  • ?????: ????? ???? MatchCollection ????? ??? ???? ????? ?? ?????? ???????.
??????? ????? ??? ????? ???? ???? ??????? ???????:
  1. ????? ??????? ?????? ?????? ??????? ??????? ???RegExp ??????.
  2. ?????? ??? ??????? ???? ?? ?????.
  3. ????? ????? IgnoreCase ?????? RegExp ??? True.
  4. ????? ??????? ???? ???? ???? ?? ?????? 2 ?????? ??? ????? ???????RegExp ??????.
  5. ????? ???? ??????? ????? ??????? ??? ???? MatchCollection.

    ????? ?????? MatchCollection ??? ??????? ??? ????? ???????.

?????? ????? ????? ??????? ??????? ?????? ?????? ?? ??? ???? ??????? ????? ??????? ?????? ?????.

???? ???? ?????

  1. ??? ????? Microsoft Visual Basic 6.0.
  2. ?? ??????? ???? ???? ??? ????? ????.
  3. ???? ??? Exe ????? ?? ???? ?????? ????? ???? ?? ???? ??? ?????.

    ?????????? ??? ????? Form1.
  4. ?? ??????? ??????? ???? "?????".
  5. ???? ????? ??????? ??? ?????? ????? VBScript Microsoft 5.5 ? ?? ???? ??? ?????.
  6. ?? ???? ???????? ???? ????? ??????? ??? CommandButton.

    ??? ????????? ????? Command1 ??? ???????.
  7. ???? ????? ??????? ??? Command1 ???? ????????? ???????? ??????.
  8. ?? ???? ???????? ???????? ??????? ?? ????? ??????? Command1_Click:
    MsgBox(TestRegExp("is.", "IS1 is2 IS3 is4"))
    ?????? ?? ??? ??????? ??? is. ??? ?????? ?? ??????? "is4 IS3 is2 IS1". ????? ??????? ???? ??? ??? (.) ????? ???? ??? ??? ???? ????? ??? ????? ???? ?? ??? ??? ?????. ??? ??? ?????? ?????? ??? ??? ????? ???? ????? ??????. ??? ?? ??? ???? ??????? ?? ????? ????? ????? ??? ??? ??? ?????.
  9. ????? ???? ??????? ??? ????? ??????? Command1_click:
    Function TestRegExp(myPattern As String, myString As String)
       'Create objects.
       Dim objRegExp As RegExp
       Dim objMatch As Match
       Dim colMatches   As MatchCollection
       Dim RetStr As String
       
       ' Create a regular expression object.
       Set objRegExp = New RegExp
    
       'Set the pattern by using the Pattern property.
       objRegExp.Pattern = myPattern
    
       ' Set Case Insensitivity.
       objRegExp.IgnoreCase = True
    
       'Set global applicability.
       objRegExp.Global = True
    
       'Test whether the String can be compared.
       If (objRegExp.Test(myString) = True) Then
    
       'Get the matches.
        Set colMatches = objRegExp.Execute(myString)   ' Execute search.
    
        For Each objMatch In colMatches   ' Iterate Matches collection.
          RetStr = RetStr & "Match found at position "
          RetStr = RetStr & objMatch.FirstIndex & ". Match Value is '"
          RetStr = RetStr & objMatch.Value & "'." & vbCrLf
        Next
       Else
        RetStr = "String Matching Failed"
       End If
       TestRegExp = RetStr
    End Function
  10. ?? ??????? ????? ? ???? ??? "????" ?????? ???????.
  11. ???? ??? Command1.

    ??? ??? ???? ????? ???? ?????? ???? ??????? ?? ?? ????? is4 IS3 is2 IS1.

?????

????? ?? ?????????? ?? ?????? ????? ??? MSDN ??????:
http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx

???????

???? ???????: 818802 - ????? ??? ??????: 16/?? ??????/1428 - ??????: 3.1
????? ???
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
????? ??????: 
kbmt kbprogramming kbstring kbhowtomaster KB818802 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????818802

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com