The Test option displays sample text, results, replaced text, and generated code, while the Design one reveals the regular expression builder, Regex analyzer, and strings used to specify the. XRegExp is also a regex utility belt with tools to make your grepping and parsing easier, while freeing you from regex cross-browser inconsistencies and other annoyances. XRegExp supports all native ES6 regular expression syntax. It supports Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 11+.
< Visual Basic
Introduction[edit]
This is a very small program that demonstrates that useful programs do not need to be large. While toying with the idea of automated download and build of source included in Wikibooks I needed to test some Regular Expressions. I searched the Web for ready made tools but found nothing that really fitted what I wanted to do. Eric Gunnerson's C# tool is very good but relies on the .NET libraries which seems an unnecessarily large overhead for such a small program. So I built my own in about fifteen minutes. Here it is, it has the bare minimum of error checking, the controls are not neatly arranged and the form is not resizeable, or rather it is but the controls don't. It has a lot of limitations and definitely needs improvement, see Exercises.
frmRegExpTester.frm[edit]
This form is the only module in the program. All the difficult work is done by the VBScript Regular Expression Library. See Regular Expressions.
The control layout on the form is just what first came to mind. It definitely needs improvement in several areas: resizeability, tab order, etc.
There is a control for each of the properties and methods of the RegExp class so you can exercise all of the capabilities of it. each of the controls reacts to the ChangedClick events by setting properties as appropriate and calling both the Test and Execute methods.
The RegExp instance is available to all the code in this module although this is not strictly necessary because we could create a new one each time.
Each of the Boolean properties is represented by a CheckBox control. The click event for each one simply sets the appropriate property value and calls the Execute method via the xExecute local subroutine.
When the form is created the Initialize event handler is called. This creates the RegExp instance and sets the properties to correspond to the values of the controls.
When the user changes either the regular expression or the source text the output is updated by calling xExecute
This is the heart of the program. All it does is to call the Execute method and then construct a string to represent the result. If the pattern is invalid then the Execute method will raise an error. this is trapped and the error description used instead of the result. The result object is declared as Object because the return type can be either Match' or MatchCollection depending on whether there is only one match or more than one. The results are shown in the txtExecuteResult and txtTestresult text boxes.
The whole purpose of the program is to show the user what the result of matching the regular expression to a text string will be. To do this we simply create a string that represents a Match or MatchCollection object.
regexptester.vbp[edit]
The project file is very simple. No unusual references except the regular expression library.
Exercises:
Retrieved from 'https://en.wikibooks.org/w/index.php?title=Visual_Basic/Regular_Expression_Tester&oldid=2405562'
| Quick Start | Tutorial | Tools & Languages | Examples | Reference | Book Reviews |
Feel free to test JavaScript’s RegExp support right here in your browser. Obviously, JavaScript (or Microsoft’s variant JScript) will need to be enabled in your browser for this to work. Since this tester is implemented in JavaScript, it will reflect the features and limitations of your web browser’s JavaScript implementation. If you’re looking for a general-purpose regular expression tester supporting a variety of regex flavors, grab yourself a copy of RegexBuddy.
Learn how to use the JavaScript RegExp object.
JavaScript RegExp Tester Source CodeMake a Donation
Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site!
| Quick Start | Tutorial | Tools & Languages | Examples | Reference | Book Reviews |
![]()
| grep | PowerGREP | RegexBuddy | RegexMagic |
| EditPad Lite | EditPad Pro |
| Boost | Delphi | GNU (Linux) | Groovy | Java | JavaScript | .NET | PCRE (C/C++) | PCRE2 (C/C++) | Perl | PHP | POSIX | PowerShell | Python | R | Ruby | std::regex | Tcl | VBScript | Visual Basic 6 | wxWidgets | XML Schema | Xojo | XQuery & XPath | XRegExp |
| MySQL | Oracle | PostgreSQL |
Regex Tester 1 17 – Regular Expression Testing Tool
Page URL: https://regular-expressions.mobi/javascriptexample.html
Page last updated: 22 November 2019 Site last updated: 05 October 2020 Copyright © 2003-2020 Jan Goyvaerts. All rights reserved. Regex Tester 1 17 – Regular Expression Testing Tool SetComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |