From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Tue, 13 Jul 2010 16:56:44 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: [9fans] regexp doubt Topicbox-Message-UUID: 3e6ab45a-ead6-11e9-9d60-3106f5b1d025 Hi, can someone tell me why the regular expression /stat[abc]?[ ;\-]/ doesn't match the string "stat-" in acme? I expect it to match, where does my mistake lie? Saludos, -- Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 13 Jul 2010 20:31:10 +0530 Message-ID: From: Vinu Rajashekhar To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=000e0cd23f0ec2e9c4048b462368 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3e731f50-ead6-11e9-9d60-3106f5b1d025 --000e0cd23f0ec2e9c4048b462368 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jul 13, 2010 at 8:26 PM, hugo rivera wrote: > Hi, > can someone tell me why the regular expression /stat[abc]?[ ;\-]/ > doesn't match the string "stat-" in acme? I expect it to match, where > does my mistake lie? > Saludos, > > It's the [abc]? I guess, it says that you want an a, b, or c after stat. > -- > Hugo > > --000e0cd23f0ec2e9c4048b462368 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Tue, Jul 13, 2010 at 8:26 PM, hugo rivera= <uair00@gmail.com= > wrote:
Hi,
can someone tell me why the regular expression /stat[abc]?[ ;\-]/
doesn't match the string "stat-" in acme? I expect it to matc= h, where
does my mistake lie?
Saludos,

It's the [abc]? I guess, it says that you want an= a, b, or c after stat.=A0
--
Hugo


--000e0cd23f0ec2e9c4048b462368-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 13 Jul 2010 17:11:17 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3e79eede-ead6-11e9-9d60-3106f5b1d025 2010/7/13 Vinu Rajashekhar : > > On Tue, Jul 13, 2010 at 8:26 PM, hugo rivera wrote: > It's the [abc]? I guess, it says that you want an a, b, or c after stat. not really, since there's a '?' REP operator there. And it actually matches strings like "stat;" -- Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 13 Jul 2010 17:15:17 +0200 Message-ID: From: "Rodolfo (kix)" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3e801ade-ead6-11e9-9d60-3106f5b1d025 Can you try: /stat[abc]?[ ;\\-]/ I am not sure (and I do not have acme here), but probably the problem is with the backslash. You can try this too: /stat[abc]?[ ;-]/ Saludos. On Tue, Jul 13, 2010 at 5:01 PM, Vinu Rajashekhar wr= ote: > > On Tue, Jul 13, 2010 at 8:26 PM, hugo rivera wrote: >> >> Hi, >> can someone tell me why the regular expression /stat[abc]?[ ;\-]/ >> doesn't match the string "stat-" in acme? I expect it to match, where >> does my mistake lie? >> Saludos, >> > It's the [abc]? I guess, it says that you want an a, b, or c after stat. >> >> -- >> Hugo >> > > --=20 Rodolfo Garc=EDa "kix" http://www.kix.es/ ham: EA4ERH @ IN80ER From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 11:18:31 -0400 To: 9fans@9fans.net Message-ID: <136f4778140ad5331b980f5d45eff3c5@coraid.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3e8c12ee-ead6-11e9-9d60-3106f5b1d025 On Tue Jul 13 11:13:03 EDT 2010, uair00@gmail.com wrote: > Hi, > can someone tell me why the regular expression /stat[abc]?[ ;\-]/ > doesn't match the string "stat-" in acme? I expect it to match, where > does my mistake lie? > Saludos, if you are doing a b3 search, you want :/stat[abc]?[ ;\-]/ just the leading : is missing. - erik From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 13 Jul 2010 17:31:16 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ea35882-ead6-11e9-9d60-3106f5b1d025 both of them yield a regexp: malformed `[]' error. I forgot to mention and I had an alternative solution from the beginning /stat[abc]?([ ;]|-)/ I'm just wondering the reason the original version failed. 2010/7/13 Rodolfo (kix) : > Can you try: > > /stat[abc]?[ ;\\-]/ > > I am not sure (and I do not have acme here), but probably the problem > is with the backslash. > > You can try this too: > > /stat[abc]?[ ;-]/ > -- Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <136f4778140ad5331b980f5d45eff3c5@coraid.com> References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> Date: Tue, 13 Jul 2010 17:31:32 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3e974fc4-ead6-11e9-9d60-3106f5b1d025 I wasn't searching, but using it with acme's x command. 2010/7/13 erik quanstrom : > On Tue Jul 13 11:13:03 EDT 2010, uair00@gmail.com wrote: >> Hi, >> can someone tell me why the regular expression /stat[abc]?[ ;\-]/ >> doesn't match the string "stat-" in acme? I expect it to match, where >> does my mistake lie? >> Saludos, > > if you are doing a b3 search, you want > > =C2=A0 =C2=A0 =C2=A0 =C2=A0:/stat[abc]?[ ;\-]/ > > just the leading : is missing. > > - erik > > --=20 Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <88f2fccf6f0ecb1a3924f8d37b52abf8@bellsouth.net> To: 9fans@9fans.net Date: Tue, 13 Jul 2010 10:37:53 -0500 From: blstuart@bellsouth.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ea99cb0-ead6-11e9-9d60-3106f5b1d025 > both of them yield a > > regexp: malformed `[]' > > error. > I forgot to mention and I had an alternative solution from the > beginning /stat[abc]?([ ;]|-)/ > I'm just wondering the reason the original version failed. As I recall, if you're going to include a hyphen in a character class, it has to be the first character so that it isn't taken to indicate a range. BLS From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <88f2fccf6f0ecb1a3924f8d37b52abf8@bellsouth.net> References: <88f2fccf6f0ecb1a3924f8d37b52abf8@bellsouth.net> Date: Tue, 13 Jul 2010 17:46:41 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3eaf8cec-ead6-11e9-9d60-3106f5b1d025 maybe I'm using a buggy version of acme, because /stat[abc]?[- ;]/ also fails with a "malformed" error. And according to the regexp(7) man page, you should be able to precede a '-' with a backslash. 2010/7/13 : >> both of them yield a >> >> regexp: malformed `[]' >> >> error. >> I forgot to mention and I had an alternative solution from the >> beginning /stat[abc]?([ ;]|-)/ >> I'm just wondering the reason the original version failed. > > As I recall, if you're going to include a hyphen in a character > class, it has to be the first character so that it isn't taken to > indicate a range. > > BLS > > > -- Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 13 Jul 2010 17:48:13 +0200 Message-ID: From: yy To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3eb58976-ead6-11e9-9d60-3106f5b1d025 2010/7/13 hugo rivera : > Hi, > can someone tell me why the regular expression /stat[abc]?[ ;\-]/ > doesn't match the string "stat-" in acme? I expect it to match, where > does my mistake lie? > Saludos, > > -- > Hugo > > It works here (both with B3 searches and Edit ,x commands). Maybe what you have in your text is an unicode dash? -- - yiyus || JGL . 4l77.com From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <06092D07-B3B3-4717-8926-CC488A487938@fastmail.fm> From: Ethan Grammatikidis To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: <88f2fccf6f0ecb1a3924f8d37b52abf8@bellsouth.net> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Tue, 13 Jul 2010 16:50:49 +0100 References: <88f2fccf6f0ecb1a3924f8d37b52abf8@bellsouth.net> Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ec70764-ead6-11e9-9d60-3106f5b1d025 On 13 Jul 2010, at 16:37, blstuart@bellsouth.net wrote: >> both of them yield a >> >> regexp: malformed `[]' >> >> error. >> I forgot to mention and I had an alternative solution from the >> beginning /stat[abc]?([ ;]|-)/ >> I'm just wondering the reason the original version failed. > > As I recall, if you're going to include a hyphen in a character > class, it has to be the first character so that it isn't taken to > indicate a range. That's posix & perl regexps. From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 12:00:46 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ecd1ba4-ead6-11e9-9d60-3106f5b1d025 > I wasn't searching, but using it with acme's x command. > > > if you are doing a b3 search, you want > > > >        :/stat[abc]?[ ;\-]/ > > > > just the leading : is missing. this works for me on a buffer of "stat-\n\n\n\n" (where \ns are newlines): Edit ,x/stat[abc]?[ ;\-]/p > As I recall, if you're going to include a hyphen in a character > class, it has to be the first character so that it isn't taken to > indicate a range. from regexp(6) [...] In s {as in [s-s]}, the metacharacters `-', `]', an initial `^', and the regular expression delimiter must be preceded by a `\'; other metacharacters have no spe- cial meaning and may appear unescaped. > maybe I'm using a buggy version of acme, because /stat[abc]?[- ;]/ > also fails with a "malformed" error. And according to the regexp(7) > man page, you should be able to precede a '-' with a backslash. no, the correct version is /stat[abc]?[\- ;]/ - erik From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> Date: Tue, 13 Jul 2010 11:38:18 -0700 Message-ID: Subject: Re: [9fans] regexp doubt From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Topicbox-Message-UUID: 3ed356a4-ead6-11e9-9d60-3106f5b1d025 I think you have found a real bug. I created a new window containing x x+ x- xy and I executed Edit ,x/x[ +\-]/d and sure enough it doesn't delete x-. Russ From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <428daa32d53325e5b5639b5cd2cd9b95@bellsouth.net> To: 9fans@9fans.net Date: Tue, 13 Jul 2010 13:46:52 -0500 From: blstuart@bellsouth.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3edea144-ead6-11e9-9d60-3106f5b1d025 > I think you have found a real bug. > > I created a new window containing > > x x+ x- xy > > and I executed Edit ,x/x[ +\-]/d > and sure enough it doesn't delete x-. Interesting. Is that in p9p acme? I just tried it in 9vx and it did delete everything except the xy. BLS From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 14:47:05 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ee494dc-ead6-11e9-9d60-3106f5b1d025 On Tue Jul 13 14:40:02 EDT 2010, rsc@swtch.com wrote: > I think you have found a real bug. > > I created a new window containing > > x x+ x- xy > > and I executed Edit ,x/x[ +\-]/d > and sure enough it doesn't delete x-. this really does work for me at coraid, but not at home. the only difference i see is the fact that at coraid, 16-bit runes are used, while i am using 32-bit runes. /n/coraid//sys/src/cmd/acme/regx.c:487,493 - regx.c:487,493 exprp++; /* eat '-' */ if((c2 = nextrec()) == ']') goto Error; - classp[n+0] = 0xFFFF; + classp[n+0] = Runemax; classp[n+1] = c1; classp[n+2] = c2; n += 3; - erik From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 14:49:50 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3eea06ce-ead6-11e9-9d60-3106f5b1d025 the problem is that OPERATOR, and nextrec() now collide with legit runes. - erik From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 13 Jul 2010 14:57:40 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ef2d358-ead6-11e9-9d60-3106f5b1d025 patch: /n/dump/2010/0713/sys/src/cmd/acme/regx.c:20,26 - regx.c:20,26 typedef struct Inst Inst; struct Inst { - uint type; /* < 0x10000 ==> literal, otherwise action */ + uint type; /* < 0x1000000 ==> literal, otherwise action */ union { int sid; int subid; /n/dump/2010/0713/sys/src/cmd/acme/regx.c:61,85 - regx.c:61,85 * 0x100xx are operators, value == precedence * 0x200xx are tokens, i.e. operands for operators */ - #define OPERATOR 0x10000 /* Bitmask of all operators */ - #define START 0x10000 /* Start, used for marker on stack */ - #define RBRA 0x10001 /* Right bracket, ) */ - #define LBRA 0x10002 /* Left bracket, ( */ - #define OR 0x10003 /* Alternation, | */ - #define CAT 0x10004 /* Concatentation, implicit operator */ - #define STAR 0x10005 /* Closure, * */ - #define PLUS 0x10006 /* a+ == aa* */ - #define QUEST 0x10007 /* a? == a|nothing, i.e. 0 or 1 a's */ - #define ANY 0x20000 /* Any character but newline, . */ - #define NOP 0x20001 /* No operation, internal use only */ - #define BOL 0x20002 /* Beginning of line, ^ */ - #define EOL 0x20003 /* End of line, $ */ - #define CCLASS 0x20004 /* Character class, [] */ - #define NCCLASS 0x20005 /* Negated character class, [^] */ - #define END 0x20077 /* Terminate: match found */ + #define OPERATOR 0x1000000 /* Bitmask of all operators */ + #define START 0x1000000 /* Start, used for marker on stack */ + #define RBRA 0x1000001 /* Right bracket, ) */ + #define LBRA 0x1000002 /* Left bracket, ( */ + #define OR 0x1000003 /* Alternation, | */ + #define CAT 0x1000004 /* Concatentation, implicit operator */ + #define STAR 0x1000005 /* Closure, * */ + #define PLUS 0x1000006 /* a+ == aa* */ + #define QUEST 0x1000007 /* a? == a|nothing, i.e. 0 or 1 a's */ + #define ANY 0x2000000 /* Any character but newline, . */ + #define NOP 0x2000001 /* No operation, internal use only */ + #define BOL 0x2000002 /* Beginning of line, ^ */ + #define EOL 0x2000003 /* End of line, $ */ + #define CCLASS 0x2000004 /* Character class, [] */ + #define NCCLASS 0x2000005 /* Negated character class, [^] */ + #define END 0x2000077 /* Terminate: match found */ - #define ISATOR 0x10000 - #define ISAND 0x20000 + #define ISATOR 0x1000000 + #define ISAND 0x2000000 /* * Parser Information /n/dump/2010/0713/sys/src/cmd/acme/regx.c:452,458 - regx.c:452,458 exprp++; return '\n'; } - return *exprp++|0x10000; + return *exprp++|0x1000000; } return *exprp++; } /n/dump/2010/0713/sys/src/cmd/acme/regx.c:492,498 - regx.c:492,498 classp[n+2] = c2; n += 3; }else - classp[n++] = c1; + classp[n++] = c1 & ~0x1000000; } classp[n] = 0; if(nclass == Nclass){ From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <428daa32d53325e5b5639b5cd2cd9b95@bellsouth.net> References: <428daa32d53325e5b5639b5cd2cd9b95@bellsouth.net> Date: Wed, 14 Jul 2010 09:47:46 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3ef8c04c-ead6-11e9-9d60-3106f5b1d025 Yes, I'm using acme from p9p. 2010/7/13 : >> I think you have found a real bug. >> >> I created a new window containing >> >> =C2=A0 =C2=A0x x+ x- xy >> >> and I executed Edit ,x/x[ +\-]/d >> and sure enough it doesn't delete x-. > > Interesting. =C2=A0Is that in p9p acme? =C2=A0I just tried it in 9vx > and it did delete everything except the xy. > > BLS > > > --=20 Hugo From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> Date: Wed, 14 Jul 2010 11:11:52 -0700 Message-ID: Subject: Re: [9fans] regexp doubt From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Topicbox-Message-UUID: 3f043d82-ead6-11e9-9d60-3106f5b1d025 thanks for tracking this down. fixed in p9p, with some extra names. sam needs the same changes. libregexp is okay. http://code.swtch.com/plan9port/changeset/239be7f74189 russ From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <136f4778140ad5331b980f5d45eff3c5@coraid.com> Date: Thu, 15 Jul 2010 10:15:38 +0200 Message-ID: From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] regexp doubt Topicbox-Message-UUID: 3f12ecec-ead6-11e9-9d60-3106f5b1d025 Thanks to you, guys. 2010/7/14 Russ Cox : > thanks for tracking this down. > fixed in p9p, with some extra names. > sam needs the same changes. > libregexp is okay. > > http://code.swtch.com/plan9port/changeset/239be7f74189 > > russ > > -- Hugo