Re: regex: ] in a character class

2020-12-12 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote: I don't have a suggestion for better wording yet. [1] https://dlang.org/phobos/std_regex.html This [1] is how I would word it. [1] https://github.com/dlang/phobos/pull/7724

Re: regex: ] in a character class

2020-12-12 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote: In some situations a ] must be escaped as in auto re = regex(`^[a\]]$`); // match a and ] only Unfortunately dmd/phobos does not warn if you forget the backslash: auto re = regex(`^[a]]$`); // match a] This leads me to the

regex: ] in a character class

2020-12-12 Thread kdevel via Digitalmars-d-learn
In some situations a ] must be escaped as in auto re = regex(`^[a\]]$`); // match a and ] only Unfortunately dmd/phobos does not warn if you forget the backslash: auto re = regex(`^[a]]$`); // match a] This leads me to the documentation [1] which says \c where c is one of [|*+?()