View previous topic :: View next topic |
Author |
Message |
Linker
Joined: 06 Nov 2006 Posts: 29 Location: Almaty, Kazakhstan
|
Posted: Wed Nov 14, 2007 11:31 am Post subject: Issues with scregexp |
|
|
Hello.
I've stumbled upon scregexp, which turned out to be a great thing!
However, regexps like "//[^\n]*" work strangely: comments say that the engine is greedy, but the match is just a "//". I experimented a bit and noticed some issues:
How do you escape characters in regexp strings? escape twice or use wysiwyg strings (both give strange results when dealing with character classes like the one above)?
Docs state that an expression can be in the /regexp/ form, as well as just regexp (without the forward slashes); but trying to use the second form gives strange compilation errors (out-of-bounds array access)
Your library can make my life a lot easier...
I'm using DMD1.23 under Windows XP SP2. (If you need exact compilation messages, let me know.) |
|
Back to top |
|
|
mp4
Joined: 22 Jun 2007 Posts: 19
|
Posted: Sun Nov 18, 2007 5:44 pm Post subject: Re: Issues with scregexp |
|
|
I will have a look. |
|
Back to top |
|
|
mp4
Joined: 22 Jun 2007 Posts: 19
|
Posted: Mon Nov 19, 2007 2:31 pm Post subject: Re: Issues with scregexp |
|
|
Linker wrote: | Hello.
I've stumbled upon scregexp, which turned out to be a great thing!
However, regexps like "//[^\n]*" work strangely: comments say that the engine is greedy, but the match is just a "//". I experimented a bit and noticed some issues:
How do you escape characters in regexp strings? escape twice or use wysiwyg strings (both give strange results when dealing with character classes like the one above)?
Docs state that an expression can be in the /regexp/ form, as well as just regexp (without the forward slashes); but trying to use the second form gives strange compilation errors (out-of-bounds array access)
Your library can make my life a lot easier...
I'm using DMD1.23 under Windows XP SP2. (If you need exact compilation messages, let me know.) |
"//[^\n]*" does not work as it denotes any empty regular expression with weird options.
Empty regular expressions are not compiled at the moment..
You need to escape both // .
This will work: "\\/\\/[^\n]*" or r"\/\/[^\n]*"
screg had also two bugs which prevented the above from running properly.
Those I have fixed. Download scregexp again.
Good Luck!
Last edited by mp4 on Fri Nov 23, 2007 5:21 am; edited 1 time in total |
|
Back to top |
|
|
Linker
Joined: 06 Nov 2006 Posts: 29 Location: Almaty, Kazakhstan
|
Posted: Thu Nov 22, 2007 12:33 pm Post subject: |
|
|
I'm grateful for your cooperation.
Thanks a lot! |
|
Back to top |
|
|
|