The Visual grep Project

Team Fly 

Page 582

    End Try
    If txtReplace.Text.Trim <> ''" Then
        txtText.Text = RX.Replace(txtText.Text, txtReplace.Text)
    Else
        Dim MatchEval As New MatchEvaluator(AddressOf UCaseEvaluator)
        txtText.Text = _
               RX.Replace(txtText.Text, txtPattern.Text, MatchEval)
    End If
End Sub

The Visual grep Project

One of the classic (and most popular) tools of the Unix operating system is the grep utility, which searches text files with regular expressions. Even though it's spelled in lowercase, it stands for General Regular Expression Parser. The application's interface is shown in Figure 19.8. I've actually tried to emulate the look of the old monitors by using shades of green on the visual interface of the application, but you may find them objectionable.

The Visual grep project is a visual adaptation of the grep utility. It allows you to select any number of text files on your drive and apply a regular expression against them. The names of the selected files appear in the ListBox control at the top of the form and you can add/remove files with the Add and Remove buttons. Once you've selected the files you want to process, you can type a regular expression, or select one of the predefined regular expressions by clicking the button with the ellipses. A dialog box, shown in Figure 19.9, will pop up; here you can select a regular expression by its description and click the OK button to paste the regular expression that corresponds to the selected description onto the appropriate box on the application's main form.

image

FIGURE 19.8 Using the Visual grep project to locate e-mail addresses with a regular expression

Team Fly 


Visual Basic  .NET Power Tools
Visual Basic .NET Power Tools
ISBN: 0782142427
EAN: 2147483647
Year: 2003
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net