Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1553

[VB6] RegEx - Regular expression engine

$
0
0
- RegEx engine compiles a regular expression string into a VM bytecode.
- It was inspired by the article by Russ Cox.
- Some features have been added and others have been changed.
- Non-recursive implementation, except for lookahead.
- This RegEx suports:

1. Special characters, metacharacters:

\t, \r, \v, \n, \f, \_ (Space)
\+, \-, \*, \(, \) ...

2. Character classes:

\d, \D, \w, \W, \s, \S

3. Custom character classes (character classes are not allowed):

[xyz], [^xyz], [+*/-], [_a-fA-F0-9], . (Dot)

4. Anchors:

^, $

5. Quantifiers:

Greedy, Lazy (?) and Possessive (+)

6. Alternation:

A|B|AB

7. Grouping (non-captured and captured):

(:...), (...)

8. Positive and negative lookahead:

(?=...), (?!...)

9. NEW: Regex search & replace:

(?$C regex), \i (one char back), \I (Back to start)

Example:
((?$S 0S?1)\i\i | . )+
recognizes the language: {0^n 1^n}, n>0

10. NEW: Keep the matched text, \K, \O:

"\K [^"]* \O"

- Caution! This software is intended for educational and experimental purposes and has not been sufficiently tested. There are no warranties of any kind!




- Usage: Insert a regex and a text. Then press buttons: Translate, Compile and Run
Attached Files

Viewing all articles
Browse latest Browse all 1553

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>