digitalmars.D - Regular expressions
- Markus Dangl (29/29) Jan 02 2005 Hi again,
- h3r3tic (5/13) Jan 02 2005 I don't know. That's weird, here's my output:
- Markus Dangl (3/21) Jan 02 2005 oh i forgot: DMD.110; WinXP.SP2.De
- Walter (3/24) Jan 03 2005 I also get the correct results (-1 and 4) with 110.
Hi again, this time i got a problem with regexp. The documentation says: int search(char[] string) Search string[] for match with regular expression. Returns Description >=0 index of match -1 no match But this program: <code> private import std.regexp; private import std.stdio; int main(char[][] arg) { char[] str1 = "TEST"; char[] str2 = "TEST.bmp"; RegExp regexp = new RegExp("\\.bmp$", "i"); int i = regexp.search(str1); int j = regexp.search(str2); writef("regexp.search(\"%s\") == %s\n", str1, i); writef("regexp.search(\"%s\") == %s\n", str2, j); return 0; } </code> prints: regexp.search("TEST") == 0 regexp.search("TEST.bmp") == 1 ... what am i doing wrong? Thanks, Markus
Jan 02 2005
Markus Dangl wrote:(...) prints: regexp.search("TEST") == 0 regexp.search("TEST.bmp") == 1 ... what am i doing wrong?I don't know. That's weird, here's my output: regexp.search("TEST") == -1 regexp.search("TEST.bmp") == 4 DMD.110; WinXP.SP2.En
Jan 02 2005
h3r3tic schrieb:Markus Dangl wrote:oh i forgot: DMD.110; WinXP.SP2.De This "bug" occurs since i upgraded from DMD.109(...) prints: regexp.search("TEST") == 0 regexp.search("TEST.bmp") == 1 ... what am i doing wrong?I don't know. That's weird, here's my output: regexp.search("TEST") == -1 regexp.search("TEST.bmp") == 4 DMD.110; WinXP.SP2.En
Jan 02 2005
"Markus Dangl" <danglm in.tum.de> wrote in message news:craef3$um0$1 digitaldaemon.com...h3r3tic schrieb:I also get the correct results (-1 and 4) with 110.Markus Dangl wrote:oh i forgot: DMD.110; WinXP.SP2.De This "bug" occurs since i upgraded from DMD.109(...) prints: regexp.search("TEST") == 0 regexp.search("TEST.bmp") == 1 ... what am i doing wrong?I don't know. That's weird, here's my output: regexp.search("TEST") == -1 regexp.search("TEST.bmp") == 4 DMD.110; WinXP.SP2.En
Jan 03 2005