NauticalGent
Ignore List Poster Boy
- Local time
- Today, 08:57
- Joined
- Apr 27, 2015
- Messages
- 6,747
The "meat and potatoes" of my main client's application requires large formatted text files to be read, parsed and "stuffed" into appropriate tables.
The existing code used various methods to achieve this, Instr() being one of them. Although Instr() and InstrRev() are useful and can get the job done (for the most part), they are somewhat limited (IMHO)
Fortunately for me, there was a true programmer(Perl, Java, C++) on the staff who took pity on me and introduced me to Regular Expressions, or RegEx. RegEx is much more powerful and can do so much more, such as string/pattern matching, replacement and much, much more. He wrote this sub for me to use while I was getting my hands dirty.
Here is one of the best online sources I have found in regards to RegEx tutorials. Even I was able to understand (most) of it, and that takes some doing!
https://www.youtube.com/watch?v=7DG3kCDx53c
To use it, you must reference MS VBScript Regular Expressions 5.5 in the VBE.
There is only one form, frmInput, that has two unbound fields. Simply type or paste the text you want to evaluate in the first field, and the RegEx pattern you want to test for and click the Test button. If a match is found, it will show all matches in a MsgBox, if not it will alert you that there were no matches. Nothing to it!
Take it for a spin and kick the tires. Always open to suggestions on improvement...
The existing code used various methods to achieve this, Instr() being one of them. Although Instr() and InstrRev() are useful and can get the job done (for the most part), they are somewhat limited (IMHO)
Fortunately for me, there was a true programmer(Perl, Java, C++) on the staff who took pity on me and introduced me to Regular Expressions, or RegEx. RegEx is much more powerful and can do so much more, such as string/pattern matching, replacement and much, much more. He wrote this sub for me to use while I was getting my hands dirty.
Here is one of the best online sources I have found in regards to RegEx tutorials. Even I was able to understand (most) of it, and that takes some doing!
https://www.youtube.com/watch?v=7DG3kCDx53c
To use it, you must reference MS VBScript Regular Expressions 5.5 in the VBE.
There is only one form, frmInput, that has two unbound fields. Simply type or paste the text you want to evaluate in the first field, and the RegEx pattern you want to test for and click the Test button. If a match is found, it will show all matches in a MsgBox, if not it will alert you that there were no matches. Nothing to it!
Take it for a spin and kick the tires. Always open to suggestions on improvement...