Thread overview |
---|
March 11, 2007 regular expressions | ||||
---|---|---|---|---|
| ||||
Hi, just as a short note, is seems as if either a. the regex parser does not work as documented, or b. I have somehow messed up. To be precise, http://www.digitalmars.com/ctg/regular.html says that "." matches any character. I seem to have found at least one exception, the newline character "\n". Example the string "abc\ndef" is not matched by "^\".*\"$", but is by "^\"(.|\n)*\"$". Can anyone confirm? Happy hacking, 0ffh |
March 11, 2007 Re: regular expressions | ||||
---|---|---|---|---|
| ||||
Posted in reply to 0ffh | 0ffh wrote:
> Hi,
>
> just as a short note, is seems as if either
>
> a. the regex parser does not work as documented, or
> b. I have somehow messed up.
>
> To be precise, http://www.digitalmars.com/ctg/regular.html says
> that "." matches any character. I seem to have found at least
> one exception, the newline character "\n".
> Example the string "abc\ndef" is not matched by "^\".*\"$",
> but is by "^\"(.|\n)*\"$".
>
> Can anyone confirm?
It's standard in regex syntax that the dot doesn't match a newline. Should probably have been mentioned in the docs, though.
Usually there's modifier than makes the dot match newlines too, but I can't see one on that page.
|
March 11, 2007 Re: regular expressions | ||||
---|---|---|---|---|
| ||||
Posted in reply to torhu | torhu wrote: > 0ffh wrote: >> [...] >> To be precise, http://www.digitalmars.com/ctg/regular.html says >> that "." matches any character. I seem to have found at least >> one exception, the newline character "\n". >> [...] > It's standard in regex syntax that the dot doesn't match a newline. Should probably have been mentioned in the docs, though. > [...] Well, that would appear to be the reason, then. As I have found a trivial workaround, it's just as well.... :) Thanks, 0ffh |
Copyright © 1999-2021 by the D Language Foundation