Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 26, 2007 Regexp help (possible bug?) | ||||
---|---|---|---|---|
| ||||
--- import std.regexp; int main () { char[] foo = "foo = bar"; int i = std.regexp.find(foo, "[^\\]#"); return 0; } --- This outputs "Error: invalid range". According to the documentation, this should return -1, since the input does not contain an octalthorpe (#) that is not preceded by a backslash. Adding an octalthorpe doesn't help matters; it produces the same error. Also, adding the attribute argument doesn't help. With an example this small, I think this is probably a bug, but I'd like to check here before submitting a report -- am I doing something wrong? |
May 26, 2007 Re: Regexp help (possible bug?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to gareis | Argh -- forget that. I forget that regexps require an extra level of escaping; that should have been: --- std.regexp.find(foo, "[^\\\\]#"); --- This is why I ask now rather than submitting bug reports first. Thanks! |
May 26, 2007 Re: Regexp help (possible bug?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to gareis | "gareis" <dhasenan@gmail.com> wrote in message news:f399o6$n1f$1@digitalmars.com... > Argh -- forget that. I forget that regexps require an extra level of > escaping; > that should have been: > --- > std.regexp.find(foo, "[^\\\\]#"); If you use WYSIWYG strings, you can avoig the ugly double escaping: std.regexp.find(foo, r"[^\\]#"); or std.regexp.find(foo, `[^\\]#`); I've also never heard of a pound sign being called an "octalthorpe"? |
May 26, 2007 Re: Regexp help (possible bug?) | ||||
---|---|---|---|---|
| ||||
Posted in reply to gareis | gareis schrieb:
> Argh -- forget that. I forget that regexps require an extra level of escaping;
> that should have been:
> ---
> std.regexp.find(foo, "[^\\\\]#");
> ---
>
> This is why I ask now rather than submitting bug reports first.
>
> Thanks!
---
int i = std.regexp.find(foo, r"[^\\]#");
---
works as well
david
|
May 26, 2007 OT: U+0023 (was Re: Regexp help (possible bug?)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > I've also never heard of a pound sign being called an "octalthorpe"? > http://en.wikipedia.org/wiki/Number_sign -- Remove ".doesnotlike.spam" from the mail address. |
May 29, 2007 Re: OT: U+0023 (was Re: Regexp help (possible bug?)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Deewiant | Deewiant wrote:
> Jarrett Billingsley wrote:
>> I've also never heard of a pound sign being called an "octalthorpe"?
>>
>
> http://en.wikipedia.org/wiki/Number_sign
>
Where I come from, 'pound sign' has always meant ₤, and # is 'hash'. (BTW, what do you call ₤?)
|
May 29, 2007 Re: OT: U+0023 (was Re: Regexp help (possible bug?)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | "Don Clugston" <dac@nospam.com.au> wrote in message news:f3grec$uqq$1@digitalmars.com... >> > Where I come from, 'pound sign' has always meant ?, and # is 'hash'. (BTW, what do you call ??) Oh I guess that's called a pound sign too, but whenever you say "pound sign" here it means almost certainly #. We might call ? a "British pound sign" or so. |
May 29, 2007 Re: OT: U+0023 (was Re: Regexp help (possible bug?)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote:
> "Don Clugston" <dac@nospam.com.au> wrote in message news:f3grec$uqq$1@digitalmars.com...
>> Where I come from, 'pound sign' has always meant ?, and # is 'hash'. (BTW, what do you call ??)
>
> Oh I guess that's called a pound sign too, but whenever you say "pound sign" here it means almost certainly #. We might call ? a "British pound sign" or so.
>
>
I've oft heard it called a "Sterling".
-- Chris Nicholson-Sauls
|
Copyright © 1999-2021 by the D Language Foundation