- 1 Preface
- 2 About then AutoIt regular expression implementation
- 3 Why learn and use regular expressions?
- 4 Some simple samples
- 5 Using regular classes
- 6 Creating classes
- 7 Using groups
- 8 Collection of working samples
- 9 Other resources
This tutorial is about regular expressions as they are understood by AutoIt.
About then AutoIt regular expression implementation
Before and after the PCRE implementation. StringRegExp StringRegExpReplace
Why learn and use regular expressions?
Some simple samples
Using regular classes
Collection of working samples
$a = StringRegExp("Some words to extract", "[\w]+", 3) _ArrayDisplay($a, "Extracted words")
$a = StringRegExp("Some words to extract", "(.*)", 3) _ArrayDisplay($a, "Extracted lines")
Extracting comment groups:
Tested, verified, and working on pretty much any sentences... Needs work on words spelled with punctuation symbols, such as Mr., Mrs. Can be handled prior to regex testing by changed to mister and misses.
Local $a $a = StringRegExp($data, "(['""\w\d\(\),\;\:\-\@\&\s]+(?:.\w+)?+[\.\!\?])", 3) _ArrayDisplay($a, "Extracted lines")
AutoIt normalize variable declarations:
Collect Global, Local and Dim statements in selected code and create declaration code to be inserted as a group in the file TODO: Not tested!
Local $a $a = StringRegExp($data, "\s*(Global|Local|Dim)(\s+$\w+)", 3) _ArrayDisplay($a, "Extracted lines")
Links to other resources or forum topics regarding the use of regular expressions in AutoIt. Forum beginners tutorial by (TODO: @??? can't find it at the moment), really nice and well written.