![]() | |
#41
| |||
| |||
|
|
The only thing with using a C/C++ or any other external method is portability. It looses the ability to be used across multiple platforms. I am currently on D3, but use Universe, jBase, etc. and would need a way to make it work on all. |
|
Plus, the real gains in RegEx speed are in the RegEx compiler (compile it once, run it many times). I would have to have a way to compile the RegEx and return it to D3/Universe/etc. for use later otherwise it has to recompile each time and that would really slow some of them down. |
|
I have a very basic Thompson RegEx engine working now, written in BASIC. I can do pretty much all of the simple stuff except {m,n} and I haven't implemented any POSIX or Perl classes yet like [ IGITS:]and such. I can do: ABC .*ABC ABC.* A+B* [0-9]+ [\d]+ etc. If anyone is interested I would share the code. It's pretty straight forward, byte compiles the regex, then runs the bytecode against a string for matching. That is all. I have implemented: ., \d, \w and \s, +, *, [], (), | but that is all. The () are not a real group either, just a way to keep an alternation (|) together, but will not return the matched text if within the () or anything. One thing I haven't figured out yet is .*A.* to match an A anywhere in the string, it matches anywhere except at the end. Very strange as .*A will match it only at the end without issue. It has to do with the backtracking but not sure where yet. Oh well, it's all fun until someone gets hurt... M |
![]() |
| Thread Tools | |
| Display Modes | |
| |