From forsythe at primenet.com Thu Feb 1 09:56:09 2001 From: forsythe at primenet.com (Tran Forsythe) Date: Thu Aug 5 00:16:20 2004 Subject: Reminder: Phoenix.pm: Meeting 02/01/2001 References: <3A786C48.2C4D9A1E@bpxinternet.com> Message-ID: <003701c08c67$805a5e20$0301a8c0@tran> Gonna do my best to be there ;) -Kurt ------ "Push to test." "Release to detonate." -Brad Morrison From doug.miles at bpxinternet.com Fri Feb 2 14:07:22 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:20 2004 Subject: Phoenix.pm: Regex question Message-ID: <3A7B137A.BC3D07DC@bpxinternet.com> This is probably something obvious, but I don't have my regex book with me, and can't seem to figure it out. I'm trying to parse space delimited information, somewhat like the UNIX command line. Whitespace delimits parameters, but parameters can containg whitespace if surrounded by quotes. Here's the code: #!/usr/bin/perl my $string = qq(DailyNAV "Class C" nav); my @tokens = $string =~ /(\S+)/g; print join('|', @tokens) . "\n"; my @tokens = $string =~ /"([^"]+)"/g; print join('|', @tokens) . "\n"; my @tokens = $string =~ /"([^"]+)"|(\S+)/g; print join('|', @tokens) . "\n"; here is the output: DailyNAV|"Class|C"|nav Class C |DailyNAV|Class C|||nav The first two regexes do what I expect. When I combine them in the third, I get extra "null matches". Any ideas as to what I'm doing wrong? -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From phaedrus at contactdesigns.com Fri Feb 2 12:56:27 2001 From: phaedrus at contactdesigns.com (Scott Walters) Date: Thu Aug 5 00:16:20 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <3A7B137A.BC3D07DC@bpxinternet.com> Message-ID: Doug, |DailyNAV|Class C|||nav <-- output of your version ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string Regex can match 0 character things, like with split //, $str;... but looking at the regex, nothing in there would match something 0 chracters long, so I don't know =) Hmm. Tried a few other regexes that also "should work" and had no luck. Only thing I can think of is work around the mystery/problem: my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; -scott On Fri, 2 Feb 2001, Doug Miles wrote: > This is probably something obvious, but I don't have my regex book with > me, and can't seem to figure it out. I'm trying to parse space > delimited information, somewhat like the UNIX command line. Whitespace > delimits parameters, but parameters can containg whitespace if > surrounded by quotes. Here's the code: > > #!/usr/bin/perl > > my $string = qq(DailyNAV "Class C" nav); > > my @tokens = $string =~ /(\S+)/g; > my @tokens = $string =~ /"([^"]+)"/g; > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > print join('|', @tokens) . "\n"; > > here is the output: > > DailyNAV|"Class|C"|nav > Class C > |DailyNAV|Class C|||nav > > The first two regexes do what I expect. When I combine them in the > third, I get extra "null matches". Any ideas as to what I'm doing > wrong? > > -- > - Doug > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > DMCA! > From doug.miles at bpxinternet.com Fri Feb 2 17:08:56 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:20 2004 Subject: Phoenix.pm: Regex question References: Message-ID: <3A7B3E08.4369E861@bpxinternet.com> Scott Walters wrote: > > Doug, > > |DailyNAV|Class C|||nav <-- output of your version > ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string > > Regex can match 0 character things, like with split //, $str;... but looking > at the regex, nothing in there would match something 0 chracters long, so > I don't know =) Yeah, I had the same line of thought. > Hmm. Tried a few other regexes that also "should work" and had no luck. Only > thing I can think of is work around the mystery/problem: > > my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; Thanks for the reply. I might just have to do the grep thing. If I ever figure it out, I'll post to the list... Anyone else? -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From josh at autodispatch.com Fri Feb 2 17:36:01 2001 From: josh at autodispatch.com (Josh Hardison at ADS) Date: Thu Aug 5 00:16:20 2004 Subject: Phoenix.pm: Regex question In-Reply-To: Message-ID: Doug, Take the paren's out of the expression: my @tokens = $string =~ /"[^"]+"|\S+/g; When you match on one side of the pipe, you get an empty match on the other. Something like that, anyway. Kinda unintuitive. Josh Hardison On Fri, 2 Feb 2001, Scott Walters wrote: > > Doug, > > |DailyNAV|Class C|||nav <-- output of your version > ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string > > Regex can match 0 character things, like with split //, $str;... but looking > at the regex, nothing in there would match something 0 chracters long, so > I don't know =) > > Hmm. Tried a few other regexes that also "should work" and had no luck. Only > thing I can think of is work around the mystery/problem: > > my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; > > -scott > > > > On Fri, 2 Feb 2001, Doug Miles wrote: > > > This is probably something obvious, but I don't have my regex book with > > me, and can't seem to figure it out. I'm trying to parse space > > delimited information, somewhat like the UNIX command line. Whitespace > > delimits parameters, but parameters can containg whitespace if > > surrounded by quotes. Here's the code: > > > > #!/usr/bin/perl > > > > my $string = qq(DailyNAV "Class C" nav); > > > > my @tokens = $string =~ /(\S+)/g; > > my @tokens = $string =~ /"([^"]+)"/g; > > > > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > print join('|', @tokens) . "\n"; > > > > here is the output: > > > > DailyNAV|"Class|C"|nav > > Class C > > |DailyNAV|Class C|||nav > > > > The first two regexes do what I expect. When I combine them in the > > third, I get extra "null matches". Any ideas as to what I'm doing > > wrong? > > > > -- > > - Doug > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > DMCA! > > > From mdearman at inficad.com Fri Feb 2 18:53:46 2001 From: mdearman at inficad.com (Michael Dearman) Date: Thu Aug 5 00:16:20 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> Message-ID: <3A7B569A.5C8E9494@inficad.com> Love a good regex mystery. This one still just that. Using the no-paren-mem operater with your last regex appears to do away with the nulls. my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; Why? *shrug* Mike D. From doug.miles at bpxinternet.com Fri Feb 2 17:49:24 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: Message-ID: <3A7B4784.AF124C12@bpxinternet.com> OK, I figured it out. The first set of "()"s is $1 the second set is $2. $1 and $2 BOTH get returned each time regardless of a match. Thus the undefs. Here's the code I used to figure it out: #!/usr/bin/perl my $string = qq(DailyNAV "Class C" nav); while($string =~ /"([^"]+?)"|(\S+)/g) { my $token1 = $1; my $token2 = $2; my $match_length = length($&); my $position = pos($string); print "$token1|$token2|$match_length|$position\n"; } Here's the output: |DailyNAV|8|8 Class C||9|18 |nav|3|22 You can see that either $1 or $2 is undef depending on which matches. Obvious in retrospect. Oh well, I guess I learned something. Thanks for the grep. I used it. :) Scott Walters wrote: > > Doug, > > |DailyNAV|Class C|||nav <-- output of your version > ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string > > Regex can match 0 character things, like with split //, $str;... but looking > at the regex, nothing in there would match something 0 chracters long, so > I don't know =) > > Hmm. Tried a few other regexes that also "should work" and had no luck. Only > thing I can think of is work around the mystery/problem: > > my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; > > -scott > > On Fri, 2 Feb 2001, Doug Miles wrote: > > > This is probably something obvious, but I don't have my regex book with > > me, and can't seem to figure it out. I'm trying to parse space > > delimited information, somewhat like the UNIX command line. Whitespace > > delimits parameters, but parameters can containg whitespace if > > surrounded by quotes. Here's the code: > > > > #!/usr/bin/perl > > > > my $string = qq(DailyNAV "Class C" nav); > > > > my @tokens = $string =~ /(\S+)/g; > > my @tokens = $string =~ /"([^"]+)"/g; > > > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > print join('|', @tokens) . "\n"; > > > > here is the output: > > > > DailyNAV|"Class|C"|nav > > Class C > > |DailyNAV|Class C|||nav > > > > The first two regexes do what I expect. When I combine them in the > > third, I get extra "null matches". Any ideas as to what I'm doing > > wrong? > > > > -- > > - Doug > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > DMCA! > > -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From djmilesfamily at earthlink.net Fri Feb 2 18:01:50 2001 From: djmilesfamily at earthlink.net (Doug and Julie Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Fwd: Staffing IT courses Message-ID: <5.0.2.1.0.20010202170142.025a8a40@mail.earthlink.net> >Date: Sat, 27 Jan 2001 18:29:56 -0500 (EST) >From: Miles Murdocca >To: djmilesfamily@earthlink.net, jkimbrou@iiusa.cc, murdocca@cs.rutgers.edu >Subject: Staffing IT courses > >Dear Doug, > >I serve as the Director of the Rutgers University Internet Institute, >which offers noncredit continuing education courses in information >technology (IT) in New Jersey and India. Jeania Kimbrough (Phoenix) and I >also represent Internet Institute USA, which runs the operations aspect >of IT education courses. We are working with the Rutgers >Office of Continuous Education and Outreach to form a partnership >with the University of Arizona Extended University to offer IT >courses in midtown Phoenix starting in April, 2001. > >We are staffing our courses and asking for your help. Would you >help us with potential contacts who might be interested in teaching IT >education courses? We are looking for instructors who know Java, Web page >design, CGI/Perl, PHP, Microsoft, Cisco, VB, Unix, and Oracle technologies, >among others. To give you an idea of what kinds of courses we are >looking to staff, please see the draft schedule below. We will >pay to train and certify instructors. > >We are setting up meetings with potential instructors and >related contacts the week of February 5 and would like to >meet you, so that you can learn more about what we are doing, and to see >if there is some way that we can work together. > >Please let us know if there is a time we could meet you. We know >you are busy -- just long enough to drop off a business card and >say hello would be great, although we can meet with you longer, >as your interest allows. Please let us know. > >All the best, > >-- Jeania Kimbrough and Miles Murdocca > >=================== >Miles Murdocca, PhD 732-748-8806 (phone) >Director, Internet Institute 732-748-9768 (fax) >Rutgers University murdocca@cs.rutgers.edu (email) >One Possumtown Road http://www.cs.rutgers.edu/~murdocca (Personal) >Piscataway, NJ 08854 http://internet.rutgers.edu/II (Continuing >Ed.) > >Jeania Kimbrough, M.A. (602) 462-5788 (phone) >Internet Institute USA (732) 905-3058 (fax) >5025 N. Central Ave, #433 >Phoenix, AZ 85012-1520 >jkimbrou@iiusa.cc >http://www.internetinstituteusa.com > > >Note: This is only the schedule for the two labs that are targeted to >come online in April. The remaining labs will be built over the >coming months. The schedule is not yet posted and so changes can be easily >made depending on instructor availability. The MCSE and Unix classes are not >yet scheduled. The two Oracle classes (SQL and DBA) will be restructured >and expanded into 5 courses that correspond to the 5 DBA exams. The Oracle >schedule shown below marks the days that the revised sequence will be >offered. > > > UAII COURSE NUMBERINGS AND SPRING 2001 SCHEDULE > (Note: 1 Day = 2 evenings) > >UAII-110: Java Programming for Non-Programmers (12 evenings) >UAII-210: Migrating to Object Oriented Programming with Java Technology (7 >eves) >UAII-275: Java Programming Language (12 evenings) >UAII-310: Interconnection Cisco Network Devices (ICND) (5 days) >UAII-320: Building Scalable Cisco networks (BSCN) (5 days) >UAII-321: Building Cisco Multilayer Switched Networks (BCMSN) (5 days) >UAII-323: Building Cisco Remote Access Networks (BCRAN) (5 days) >UAII-324: Cisco Internetworking Troubleshooting (CIT) (5 days) >UAII-364: Fundamentals of Oracle (8 days) >UAII-365: Oracle Database Administration (8 days) >UAII-421: HTML 1: Introduction to Builidng Web Sites (3 evenings) >UAII-422: HTML 2: Web Site Construction and Design (3 evenings) >UAII-423: HTML 3: Effective Web Design (3 evenings) >UAII-424: HTML 4: Designing with Cascading Style Sheets (3 evenings) >UAII-425: HTML 5: Web Site Management (3 evenings) >UAII-426: Project Management for Web Site Development (2 evenings) >UAII-427: Portfolio Project (1 evening) >UAII-428: Front Page (2 evenings) >UAII-430: Introduction to Computer Programming - Fundamentals (6 evenings) >UAII-431: Introduction to Computer Programming - Advanced Concepts (6 >evenings) >UAII-433: Web Design, Level 2 (4 evenings) >UAII-441: Photoshop for Web Graphics (2 evenings) >UAII-454: Introduction to JavaScript (4 evenings) >UAII-480: Unix Fundamentals (6 evenings) >UAII-481: Unix Administration (6 evenings) >UAII-519: CGI Programming in Perl (4 evenings) >UAII-524: Introduction to XML (2 evenings) >UAII-528: Active Server pages (ASP) Level 1 (4 evenings) >UAII-560: Cold Fusion: Creating Database Driven Websites Level 1 (2 evenings) >UAII-571: Placing Web Sites on Microsoft Internet Information Servers (2 eves) >UAII-572: Introduction to Apache Web Server (2 evenings) >UAII-573: E-Commerce: Business to Consumer (B2C) (4 evenings) >UAII-574: E-Commerce: Internet Business Strategies (2 evenings) >UAII-575: Microsoft Access 1-3 (4 evenings) >UAII-1561: Designing a Microsoft Windows 2000 Directory Services >Infrastructure >UAII-1562 Designing: a Microsoft Windows 2000 Networking Services > Infrastructure >UAII-2150: Designing a Secure Microsoft Windows 2000 Network >UAII-2151: Microsoft Windows 2000 Network and Operating System Essentials >UAII-2152: Implementing Microsoft Windows 2000 Professional and Server >UAII-2153: Implementing Microsoft Windows 2000 Network Infrastructure >UAII-2154: Implementing and Administering Microsoft Windows 2000 Directory > Services > > > SPRING 2001 EVENING AND DAYTIME SCHEDULE >Notes: "421:01" indicates course UAII-421, section 1, meeting for 1 evening. > "XXXX" means classes are not scheduled, as for a holiday. > "421:03/412:03" Means a morning and afternoon session of 421:03. > > >Monday > | Mon Tue Wed Thu Fri Sat Sun >4/23 Lab A 421:01 421:01 421:01 > Lab B > > >4/30 Lab A 422:01 422:01 422:01 > Lab B 110:01 110:01 364:01/364:01 > > >5/7 Lab A 423:01 421:02 423:01 423:01 421:02 > Lab B 110:01 110:01 364:01/364:01 > >Morning A 310:01 310:01 310:01 310:01 310:01 >Afternoon A 310:01 310:01 310:01 310:01 310:01 > > >5/14 Lab A 424:01 421:02 424:01 424:01 422:02 > Lab B 110:01 210:01 110:01 210:01 364:01/364:01 > > >5/21 Lab A 425:01 422:02 425:01 425:01 > Lab B 110:01 210:01 110:01 210:01 > > >5/28 Lab A 426:01 423:02 421:03/412:03 > Lab B 210:01 110:01 210:01 364:01/364:01 > > >6/4 Lab A 426:01 423:02 454:01 524:01 423:02 421:03/422:03 > Lab B 110:01 210:01 110:01 364:01/364:01 > >Morning A 310:02 310:02 310:02 310:02 310:02 >Afternoon A 310:02 310:02 310:02 310:02 310:02 > > >6/11 Lab A 454:01 423:02 454:01 524:01 424:02 422:03/422:03 > Lab B 110:01 275:01 275:01 364:01/364:01 > > >6/18 Lab A 454:01 424:02 519:01 441:01 424:02 423:03/423:03 > Lab B 275:02 275:01 275:02 275:01 364:01/364:01 > >Morning A 320:01 320:01 320:01 320:01 320:01 >Afternoon A 320:01 320:01 320:01 320:01 320:01 > > >6/25 Lab A 519:01 425:02 519:01 441:01 425:02 > Lab B 275:02 275:01 275:02 275:01 > > >7/2 Lab A 519:01 425:02 571:01 426:02 423:03/423:03 > Lab B 275:02 275:01 275:01 364:01/364:01 > > >7/9 Lab A 573:01 426:02 573:01 571:01 454:02 424:03/424:03 > Lab B 275:02 275:01 275:02 275:01 365:01/365:01 > >Morning A 310:03 310:03 310:03 310:03 310:03 >Afternoon A 310:03 310:03 310:03 310:03 310:03 > > >7/16 Lab A 573:01 524:02 573:01 574:01 454:02 425:03/425:03 > Lab B 275:02 275:01 275:02 275:01 365:01/365:01 > > >7/23 Lab A 528:01 524:02 528:01 574:01 454:02 425:03/ > Lab B 275:02 275:02 365:01/365:01 > > >7/30 Lab A 528:01 441:02 528:01 560:01 454:02 426:03/426:03 > Lab B 275:02 365:01/365:01 > >Morning A 310:04 310:04 310:04 310:04 310:04 >Afternoon A 310:04 310:04 310:04 310:04 310:04 > > >8/6 Lab A 575:01 441:02 575:01 560:01 519:02 571:02/574:02 > Lab B 365:01/365:01 > >Morning A 320:02 320:02 320:02 320:02 320:02 >Afternoon A 320:02 320:02 320:02 320:02 320:02 > > >8/13 Lab A 575:01 560:02 575:02 528:02 519:02 571:02/574:02 > Lab B 365:01/365:01 > >Morning A 321:01 321:01 321:01 321:01 321:01 >Afternoon A 321:01 321:01 321:01 321:01 321:01 > > >8/20 Lab A 560:01 528:02 572:01 528:02 519:02 > Lab B > > >8/27 Lab A 572:01 528:02 575:02 575:02 519:02 572:02/572:02 > Lab B 365:01/365:01 > > >9/3 Lab A 573:02 575:02 575:02 573:02 > Lab B 365:01/365:01 > > >9/10 Lab A 573:02 573:02 > Lab B From whitneyt at agcs.com Fri Feb 2 20:10:17 2001 From: whitneyt at agcs.com (Thomas Whitney) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> <3A7B569A.5C8E9494@inficad.com> Message-ID: <3A7B6889.B32B9178@agcs.com> How about? my @list = $string =~ /(".*?"|\S+)/g; I think it is faster without the non greedy though? What is happening with /"([^"]+)"/g; How does this work? What about with escapes? my $string = 'DailyNAV "Print \"C\"" nav'; my @list = $string =~ /("(?:\\"|.)*?"|\S+)/g; Thanks Tom Michael Dearman wrote: > Love a good regex mystery. This one still just that. > > Using the no-paren-mem operater with your last regex appears to do away with the nulls. > my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; > > Why? *shrug* > Mike D. From tcpeter at mindspring.com Fri Feb 2 21:35:56 2001 From: tcpeter at mindspring.com (tcpeter@mindspring.com) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question Message-ID: On Fri, 2 Feb 2001, Doug Miles wrote: > This is probably something obvious, I don't think so... > but I don't have my regex book with > me, and can't seem to figure it out. I'm trying to parse space > delimited information, somewhat like the UNIX command line. Whitespace > delimits parameters, but parameters can containg whitespace if > surrounded by quotes. Here's the code: > > #!/usr/bin/perl > > my $string = qq(DailyNAV "Class C" nav); > > my @tokens = $string =~ /(\S+)/g; > my @tokens = $string =~ /"([^"]+)"/g; > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > print join('|', @tokens) . "\n"; > > here is the output: > > DailyNAV|"Class|C"|nav > Class C > |DailyNAV|Class C|||nav Doug, I've been sorta lurking here a long time reading, but this is the first time I've contributed. This seems to work. It's really the same as one of yours, with just a bit of tweaking. #!/usr/bin/perl my $string = qq(DailyNAV "Class C" nav); print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; From phaedrus at contactdesigns.com Sat Feb 3 14:55:03 2001 From: phaedrus at contactdesigns.com (Scott Walters) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: link as promised re: last meeting In-Reply-To: <3A7B4784.AF124C12@bpxinternet.com> Message-ID: Ok, Everyone who made it to the meeting, thanks for your patience as I mumbled and fumbled my way through the demo. As promised, the code and sample database are posted on http://www.slowass.net/phaedrus/transient/. Thanks very much to everyone for your input.. I'm bad with names or I would thank everyone individually for their comments. I've certainly got a few ideas that I'm going to work on from this. For those of you who missed it, there is no help. The outline is too poor an vague and not enough docs exist to explain what the heck it is. Sorry =( cheers! -scott From doug.miles at bpxinternet.com Mon Feb 5 13:59:20 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: Message-ID: <3A7F0618.8EEAA946@bpxinternet.com> Josh Hardison at ADS wrote: > > Doug, > Take the paren's out of the expression: > my @tokens = $string =~ /"[^"]+"|\S+/g; > > When you match on one side of the pipe, you get an empty match on the > other. Something like that, anyway. Kinda unintuitive. Yeah, this is the behavior I want, but I don't want the quotes. I know I could s/// them, but I wanted to figure the regex out. Thanks! > > On Fri, 2 Feb 2001, Scott Walters wrote: > > > > > Doug, > > > > |DailyNAV|Class C|||nav <-- output of your version > > ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string > > > > Regex can match 0 character things, like with split //, $str;... but looking > > at the regex, nothing in there would match something 0 chracters long, so > > I don't know =) > > > > Hmm. Tried a few other regexes that also "should work" and had no luck. Only > > thing I can think of is work around the mystery/problem: > > > > my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; > > > > -scott > > > > > > > > On Fri, 2 Feb 2001, Doug Miles wrote: > > > > > This is probably something obvious, but I don't have my regex book with > > > me, and can't seem to figure it out. I'm trying to parse space > > > delimited information, somewhat like the UNIX command line. Whitespace > > > delimits parameters, but parameters can containg whitespace if > > > surrounded by quotes. Here's the code: > > > > > > #!/usr/bin/perl > > > > > > my $string = qq(DailyNAV "Class C" nav); > > > > > > my @tokens = $string =~ /(\S+)/g; > > > my @tokens = $string =~ /"([^"]+)"/g; > > > > > > > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > > print join('|', @tokens) . "\n"; > > > > > > here is the output: > > > > > > DailyNAV|"Class|C"|nav > > > Class C > > > |DailyNAV|Class C|||nav > > > > > > The first two regexes do what I expect. When I combine them in the > > > third, I get extra "null matches". Any ideas as to what I'm doing > > > wrong? > > > > > > -- > > > - Doug > > > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > > DMCA! > > > > > -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From doug.miles at bpxinternet.com Mon Feb 5 14:02:55 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> <3A7B569A.5C8E9494@inficad.com> Message-ID: <3A7F06EF.785E0BA9@bpxinternet.com> Michael Dearman wrote: > > Love a good regex mystery. This one still just that. > > Using the no-paren-mem operater with your last regex appears to do away with the nulls. > my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; > > Why? *shrug* I think that it is because of the default regex behavior to return a match. If I specify what I want with normal parens, I force it to return a $1 and a $2. See my other explanation for more info. The other thing is that this returns the quotes, which I didn't want to do. Thanks! -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From doug.miles at bpxinternet.com Mon Feb 5 14:06:07 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> <3A7B569A.5C8E9494@inficad.com> <3A7B6889.B32B9178@agcs.com> Message-ID: <3A7F07AF.5A057A54@bpxinternet.com> Thomas Whitney wrote: > > How about? > > my @list = $string =~ /(".*?"|\S+)/g; I was trying to avoid getting the quotes back also. > I think it is faster without the non greedy though? > > What is happening with /"([^"]+)"/g; How does this work? That globaly matches any sequence of a quote followed by one or more non-quotes followed by a quote. > What about with escapes? > > my $string = 'DailyNAV "Print \"C\"" nav'; > > my @list = $string =~ /("(?:\\"|.)*?"|\S+)/g; I might do this in the future, but I was trying to come up with a non-complicated test case. :) > > Michael Dearman wrote: > > > Love a good regex mystery. This one still just that. > > > > Using the no-paren-mem operater with your last regex appears to do away with the nulls. > > my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; > > > > Why? *shrug* > > Mike D. -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From doug.miles at bpxinternet.com Mon Feb 5 14:07:58 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: Message-ID: <3A7F081E.72D3928C@bpxinternet.com> tcpeter@mindspring.com wrote: > > On Fri, 2 Feb 2001, Doug Miles wrote: > > > This is probably something obvious, > > I don't think so... > > > but I don't have my regex book with > > me, and can't seem to figure it out. I'm trying to parse space > > delimited information, somewhat like the UNIX command line. Whitespace > > delimits parameters, but parameters can containg whitespace if > > surrounded by quotes. Here's the code: > > > > #!/usr/bin/perl > > > > my $string = qq(DailyNAV "Class C" nav); > > > > my @tokens = $string =~ /(\S+)/g; > > my @tokens = $string =~ /"([^"]+)"/g; > > > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > print join('|', @tokens) . "\n"; > > > > here is the output: > > > > DailyNAV|"Class|C"|nav > > Class C > > |DailyNAV|Class C|||nav > > Doug, > I've been sorta lurking here a long time reading, but this is the first time I've contributed. This seems to work. It's really the same as one of yours, with just a bit of tweaking. I'll be nice since you're a first time poster. :) > > #!/usr/bin/perl > > my $string = qq(DailyNAV "Class C" nav); > print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From edelweiss at qwest.net Mon Feb 5 14:30:42 2001 From: edelweiss at qwest.net (Anthony Nemmer) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <3A7F081E.72D3928C@bpxinternet.com> References: Message-ID: <3.0.6.32.20010205133042.0079a500@pop.phnx.qwest.net> Jesus, Doug. =) At 01:07 PM 2/5/01 -0700, you wrote: >tcpeter@mindspring.com wrote: >> >> On Fri, 2 Feb 2001, Doug Miles wrote: >> >> > This is probably something obvious, >> >> I don't think so... >> >> > but I don't have my regex book with >> > me, and can't seem to figure it out. I'm trying to parse space >> > delimited information, somewhat like the UNIX command line. Whitespace >> > delimits parameters, but parameters can containg whitespace if >> > surrounded by quotes. Here's the code: >> > >> > #!/usr/bin/perl >> > >> > my $string = qq(DailyNAV "Class C" nav); >> > >> > my @tokens = $string =~ /(\S+)/g; >> > my @tokens = $string =~ /"([^"]+)"/g; >> >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; >> > print join('|', @tokens) . "\n"; >> > >> > here is the output: >> > >> > DailyNAV|"Class|C"|nav >> > Class C >> > |DailyNAV|Class C|||nav >> >> Doug, >> I've been sorta lurking here a long time reading, but this is the first time I've contributed. This seems to work. It's really the same as one of yours, with just a bit of tweaking. > >I'll be nice since you're a first time poster. :) > >> >> #!/usr/bin/perl >> >> my $string = qq(DailyNAV "Class C" nav); >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > >-- >- Doug > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the >DMCA! > > From doug.miles at bpxinternet.com Mon Feb 5 16:15:49 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3.0.6.32.20010205133042.0079a500@pop.phnx.qwest.net> Message-ID: <3A7F2615.A92D3C54@bpxinternet.com> Anthony Nemmer wrote: > > Jesus, Doug. =) > > At 01:07 PM 2/5/01 -0700, you wrote: > >tcpeter@mindspring.com wrote: > >> > >> On Fri, 2 Feb 2001, Doug Miles wrote: > >> > >> > This is probably something obvious, > >> > >> I don't think so... > >> > >> > but I don't have my regex book with > >> > me, and can't seem to figure it out. I'm trying to parse space > >> > delimited information, somewhat like the UNIX command line. Whitespace > >> > delimits parameters, but parameters can containg whitespace if > >> > surrounded by quotes. Here's the code: > >> > > >> > #!/usr/bin/perl > >> > > >> > my $string = qq(DailyNAV "Class C" nav); > >> > > >> > my @tokens = $string =~ /(\S+)/g; > >> > my @tokens = $string =~ /"([^"]+)"/g; > >> > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > >> > print join('|', @tokens) . "\n"; > >> > > >> > here is the output: > >> > > >> > DailyNAV|"Class|C"|nav > >> > Class C > >> > |DailyNAV|Class C|||nav > >> > >> Doug, > >> I've been sorta lurking here a long time reading, but this is the first > time I've contributed. This seems to work. It's really the same as one of > yours, with just a bit of tweaking. > > > >I'll be nice since you're a first time poster. :) > > > >> > >> #!/usr/bin/perl > >> > >> my $string = qq(DailyNAV "Class C" nav); > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > > > >-- > >- Doug > > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > >DMCA! > > > > -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From doug.miles at bpxinternet.com Mon Feb 5 16:17:08 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3.0.6.32.20010205133042.0079a500@pop.phnx.qwest.net> Message-ID: <3A7F2664.2AEDE90F@bpxinternet.com> Anthony Nemmer wrote: > > Jesus, Doug. =) Sorry. That wasn't what I meant. I was just saying TMTOWTDI and welcome to the mailing list! > At 01:07 PM 2/5/01 -0700, you wrote: > >tcpeter@mindspring.com wrote: > >> > >> On Fri, 2 Feb 2001, Doug Miles wrote: > >> > >> > This is probably something obvious, > >> > >> I don't think so... > >> > >> > but I don't have my regex book with > >> > me, and can't seem to figure it out. I'm trying to parse space > >> > delimited information, somewhat like the UNIX command line. Whitespace > >> > delimits parameters, but parameters can containg whitespace if > >> > surrounded by quotes. Here's the code: > >> > > >> > #!/usr/bin/perl > >> > > >> > my $string = qq(DailyNAV "Class C" nav); > >> > > >> > my @tokens = $string =~ /(\S+)/g; > >> > my @tokens = $string =~ /"([^"]+)"/g; > >> > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > >> > print join('|', @tokens) . "\n"; > >> > > >> > here is the output: > >> > > >> > DailyNAV|"Class|C"|nav > >> > Class C > >> > |DailyNAV|Class C|||nav > >> > >> Doug, > >> I've been sorta lurking here a long time reading, but this is the first > time I've contributed. This seems to work. It's really the same as one of > yours, with just a bit of tweaking. > > > >I'll be nice since you're a first time poster. :) > > > >> > >> #!/usr/bin/perl > >> > >> my $string = qq(DailyNAV "Class C" nav); > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > > > >-- > >- Doug > > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > >DMCA! > > > > -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From chaosppp at corp.earthlink.net Mon Feb 5 16:36:24 2001 From: chaosppp at corp.earthlink.net (Phil Hartfield) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <3A7F2664.2AEDE90F@bpxinternet.com> from "Doug Miles" at Feb 05, 2001 03:17:08 PM Message-ID: <200102052236.PAA32536@asylum.phx3.mindspring.net> Heh, had to look that up in the Jargon Dictionary TMTOWTDI, MBIIYS CTLB Phil Hartfield ________ / \ |GoStats | | | | R.I.P. | | | |Dec 2000| ---------- Doug Miles wrote: > > Anthony Nemmer wrote: > > > > Jesus, Doug. =) > > Sorry. That wasn't what I meant. I was just saying TMTOWTDI and > welcome to the mailing list! > > > At 01:07 PM 2/5/01 -0700, you wrote: > > >tcpeter@mindspring.com wrote: > > >> > > >> On Fri, 2 Feb 2001, Doug Miles wrote: > > >> > > >> > This is probably something obvious, > > >> > > >> I don't think so... > > >> > > >> > but I don't have my regex book with > > >> > me, and can't seem to figure it out. I'm trying to parse space > > >> > delimited information, somewhat like the UNIX command line. Whitespace > > >> > delimits parameters, but parameters can containg whitespace if > > >> > surrounded by quotes. Here's the code: > > >> > > > >> > #!/usr/bin/perl > > >> > > > >> > my $string = qq(DailyNAV "Class C" nav); > > >> > > > >> > my @tokens = $string =~ /(\S+)/g; > > >> > my @tokens = $string =~ /"([^"]+)"/g; > > >> > > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > >> > print join('|', @tokens) . "\n"; > > >> > > > >> > here is the output: > > >> > > > >> > DailyNAV|"Class|C"|nav > > >> > Class C > > >> > |DailyNAV|Class C|||nav > > >> > > >> Doug, > > >> I've been sorta lurking here a long time reading, but this is the first > > time I've contributed. This seems to work. It's really the same as one of > > yours, with just a bit of tweaking. > > > > > >I'll be nice since you're a first time poster. :) > > > > > >> > > >> #!/usr/bin/perl > > >> > > >> my $string = qq(DailyNAV "Class C" nav); > > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > > > > > >-- > > >- Doug > > > > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > >DMCA! > > > > > > > > -- > - Doug > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > DMCA! > From jimm at amug.org Mon Feb 5 17:14:01 2001 From: jimm at amug.org (jim mckay) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <3A7F0618.8EEAA946@bpxinternet.com> Message-ID: <20010205161403-r01010600-3d0f6eee@24.21.124.54> anthony's solution is good but doesn't work if you have 2 space seperated non-quoted strings.. ie qq(DailyNAV "Class C" nav or "another nav" again); so.. my $string = qq(DailyNAV "Class C" nav or "another nav" again); $string =~ s/"(.*?)"/ $x=$1 ;$x =~ s\/\s\/+\/g; $x;/eg ; ###escape spaces @res=split(/ /,$string); print join("|",@res)."\n"; If anyone can read this, congratulations! I'm basically escaping it for url (+'s for all the spaces) kinda sloppy but it would work for html. You could use anything in place of the spaces. I was trying to figure out how to split it with "\ " for a space but.. I am a CGI guy so.. :) Jim On 2/5/01 at 12:59 PM, doug.miles@bpxinternet.com (Doug Miles) wrote: > Josh Hardison at ADS wrote: > > > > Doug, > > Take the paren's out of the expression: > > my @tokens = $string =~ /"[^"]+"|\S+/g; > > > > When you match on one side of the pipe, you get an empty match on the > > other. Something like that, anyway. Kinda unintuitive. > > Yeah, this is the behavior I want, but I don't want the quotes. I know > I could s/// them, but I wanted to figure the regex out. Thanks! > > > > > On Fri, 2 Feb 2001, Scott Walters wrote: > > > > > > > > Doug, > > > > > > |DailyNAV|Class C|||nav <-- output of your version > > > ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on > same string > > > > > > Regex can match 0 character things, like with split //, $str;... but looking > > > at the regex, nothing in there would match something 0 chracters long, so > > > I don't know =) > > > > > > Hmm. Tried a few other regexes that also "should work" and had no luck. Only > > > thing I can think of is work around the mystery/problem: > > > > > > my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g; > > > > > > -scott > > > > > > > > > > > > On Fri, 2 Feb 2001, Doug Miles wrote: > > > > > > > This is probably something obvious, but I don't have my regex book with > > > > me, and can't seem to figure it out. I'm trying to parse space > > > > delimited information, somewhat like the UNIX command line. Whitespace > > > > delimits parameters, but parameters can containg whitespace if > > > > surrounded by quotes. Here's the code: > > > > > > > > #!/usr/bin/perl > > > > > > > > my $string = qq(DailyNAV "Class C" nav); > > > > > > > > my @tokens = $string =~ /(\S+)/g; > > > > my @tokens = $string =~ /"([^"]+)"/g; > > > > > > > > > > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > > > print join('|', @tokens) . "\n"; > > > > > > > > here is the output: > > > > > > > > DailyNAV|"Class|C"|nav > > > > Class C > > > > |DailyNAV|Class C|||nav > > > > > > > > The first two regexes do what I expect. When I combine them in the > > > > third, I get extra "null matches". Any ideas as to what I'm doing > > > > wrong? > > > > > > > > -- > > > > - Doug > > > > > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > > > DMCA! > > > > > > > > > -- > - Doug > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > DMCA! > From djmilesfamily at earthlink.net Mon Feb 5 17:53:40 2001 From: djmilesfamily at earthlink.net (Doug and Julie Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <200102052236.PAA32536@asylum.phx3.mindspring.net> References: <3A7F2664.2AEDE90F@bpxinternet.com> Message-ID: <5.0.2.1.0.20010205165155.04122110@mail.earthlink.net> At 03:36 PM 2/5/01 -0700, you wrote: >Heh, had to look that up in the Jargon >Dictionary > >TMTOWTDI, MBIIYS CTLB > >Phil Hartfield > ________ >/ \ >|GoStats | >| | >| R.I.P. | >| | >|Dec 2000| >---------- This was quite an email day for me. Offended a new guy and confused everyone else. :) That's what I get for being in a hurry. So what is GoStats? >Doug Miles wrote: > > > > Anthony Nemmer wrote: > > > > > > Jesus, Doug. =) > > > > Sorry. That wasn't what I meant. I was just saying TMTOWTDI and > > welcome to the mailing list! > > > > > At 01:07 PM 2/5/01 -0700, you wrote: > > > >tcpeter@mindspring.com wrote: > > > >> > > > >> On Fri, 2 Feb 2001, Doug Miles wrote: > > > >> > > > >> > This is probably something obvious, > > > >> > > > >> I don't think so... > > > >> > > > >> > but I don't have my regex book with > > > >> > me, and can't seem to figure it out. I'm trying to parse space > > > >> > delimited information, somewhat like the UNIX command > line. Whitespace > > > >> > delimits parameters, but parameters can containg whitespace if > > > >> > surrounded by quotes. Here's the code: > > > >> > > > > >> > #!/usr/bin/perl > > > >> > > > > >> > my $string = qq(DailyNAV "Class C" nav); > > > >> > > > > >> > my @tokens = $string =~ /(\S+)/g; > > > >> > my @tokens = $string =~ /"([^"]+)"/g; > > > >> > > > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > > >> > print join('|', @tokens) . "\n"; > > > >> > > > > >> > here is the output: > > > >> > > > > >> > DailyNAV|"Class|C"|nav > > > >> > Class C > > > >> > |DailyNAV|Class C|||nav > > > >> > > > >> Doug, > > > >> I've been sorta lurking here a long time reading, but this is the > first > > > time I've contributed. This seems to work. It's really the same as > one of > > > yours, with just a bit of tweaking. > > > > > > > >I'll be nice since you're a first time poster. :) > > > > > > > >> > > > >> #!/usr/bin/perl > > > >> > > > >> my $string = qq(DailyNAV "Class C" nav); > > > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > > > > > > > >-- > > > >- Doug > > > > > > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > > >DMCA! > > > > > > > > > > > > -- > > - Doug > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > DMCA! > > From chaosppp at corp.earthlink.net Mon Feb 5 18:08:08 2001 From: chaosppp at corp.earthlink.net (Phil Hartfield) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <5.0.2.1.0.20010205165155.04122110@mail.earthlink.net> from "Doug and Julie Miles" at Feb 05, 2001 04:53:40 PM Message-ID: <200102060008.RAA13587@asylum.phx3.mindspring.net> Doug and Julie Miles wrote: > > At 03:36 PM 2/5/01 -0700, you wrote: > >Heh, had to look that up in the Jargon > >Dictionary > > > >TMTOWTDI, MBIIYS CTLB > > > >Phil Hartfield > > ________ > >/ \ > >|GoStats | > >| | > >| R.I.P. | > >| | > >|Dec 2000| > >---------- GoStats was Mr Nemmers first major perl project, eh Tony. Retired in favor of Urchin. Urchin kinda bites and isn't in perl :( Also, for a perl program to last 4 years is fairly impressive. Phil > This was quite an email day for me. Offended a new guy and confused > everyone else. :) That's what I get for being in a hurry. So what is > GoStats? > > >Doug Miles wrote: > > > > > > Anthony Nemmer wrote: > > > > > > > > Jesus, Doug. =) > > > > > > Sorry. That wasn't what I meant. I was just saying TMTOWTDI and > > > welcome to the mailing list! > > > > > > > At 01:07 PM 2/5/01 -0700, you wrote: > > > > >tcpeter@mindspring.com wrote: > > > > >> > > > > >> On Fri, 2 Feb 2001, Doug Miles wrote: > > > > >> > > > > >> > This is probably something obvious, > > > > >> > > > > >> I don't think so... > > > > >> > > > > >> > but I don't have my regex book with > > > > >> > me, and can't seem to figure it out. I'm trying to parse space > > > > >> > delimited information, somewhat like the UNIX command > > line. Whitespace > > > > >> > delimits parameters, but parameters can containg whitespace if > > > > >> > surrounded by quotes. Here's the code: > > > > >> > > > > > >> > #!/usr/bin/perl > > > > >> > > > > > >> > my $string = qq(DailyNAV "Class C" nav); > > > > >> > > > > > >> > my @tokens = $string =~ /(\S+)/g; > > > > >> > my @tokens = $string =~ /"([^"]+)"/g; > > > > >> > > > > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > > > > >> > print join('|', @tokens) . "\n"; > > > > >> > > > > > >> > here is the output: > > > > >> > > > > > >> > DailyNAV|"Class|C"|nav > > > > >> > Class C > > > > >> > |DailyNAV|Class C|||nav > > > > >> > > > > >> Doug, > > > > >> I've been sorta lurking here a long time reading, but this is the > > first > > > > time I've contributed. This seems to work. It's really the same as > > one of > > > > yours, with just a bit of tweaking. > > > > > > > > > >I'll be nice since you're a first time poster. :) > > > > > > > > > >> > > > > >> #!/usr/bin/perl > > > > >> > > > > >> my $string = qq(DailyNAV "Class C" nav); > > > > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > > > > > > > > > >-- > > > > >- Doug > > > > > > > > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > > > >DMCA! > > > > > > > > > > > > > > > > -- > > > - Doug > > > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > > > DMCA! > > > > > From edelweiss at qwest.net Mon Feb 5 18:25:45 2001 From: edelweiss at qwest.net (Anthony Nemmer) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <5.0.2.1.0.20010205165155.04122110@mail.earthlink.net> References: <200102052236.PAA32536@asylum.phx3.mindspring.net> <3A7F2664.2AEDE90F@bpxinternet.com> Message-ID: <3.0.6.32.20010205172545.0079e390@pop.phnx.uswest.net> MindSpring, R.I.P. ;-) At 04:53 PM 2/5/01 -0700, you wrote: >At 03:36 PM 2/5/01 -0700, you wrote: >>Heh, had to look that up in the Jargon >>Dictionary >> >>TMTOWTDI, MBIIYS CTLB >> >>Phil Hartfield >> ________ >>/ \ >>|GoStats | >>| | >>| R.I.P. | >>| | >>|Dec 2000| >>---------- > >This was quite an email day for me. Offended a new guy and confused >everyone else. :) That's what I get for being in a hurry. So what is >GoStats? > >>Doug Miles wrote: >> > >> > Anthony Nemmer wrote: >> > > >> > > Jesus, Doug. =) >> > >> > Sorry. That wasn't what I meant. I was just saying TMTOWTDI and >> > welcome to the mailing list! >> > >> > > At 01:07 PM 2/5/01 -0700, you wrote: >> > > >tcpeter@mindspring.com wrote: >> > > >> >> > > >> On Fri, 2 Feb 2001, Doug Miles wrote: >> > > >> >> > > >> > This is probably something obvious, >> > > >> >> > > >> I don't think so... >> > > >> >> > > >> > but I don't have my regex book with >> > > >> > me, and can't seem to figure it out. I'm trying to parse space >> > > >> > delimited information, somewhat like the UNIX command >> line. Whitespace >> > > >> > delimits parameters, but parameters can containg whitespace if >> > > >> > surrounded by quotes. Here's the code: >> > > >> > >> > > >> > #!/usr/bin/perl >> > > >> > >> > > >> > my $string = qq(DailyNAV "Class C" nav); >> > > >> > >> > > >> > my @tokens = $string =~ /(\S+)/g; >> > > >> > my @tokens = $string =~ /"([^"]+)"/g; >> > > >> >> > > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; >> > > >> > print join('|', @tokens) . "\n"; >> > > >> > >> > > >> > here is the output: >> > > >> > >> > > >> > DailyNAV|"Class|C"|nav >> > > >> > Class C >> > > >> > |DailyNAV|Class C|||nav >> > > >> >> > > >> Doug, >> > > >> I've been sorta lurking here a long time reading, but this is the >> first >> > > time I've contributed. This seems to work. It's really the same as >> one of >> > > yours, with just a bit of tweaking. >> > > > >> > > >I'll be nice since you're a first time poster. :) >> > > > >> > > >> >> > > >> #!/usr/bin/perl >> > > >> >> > > >> my $string = qq(DailyNAV "Class C" nav); >> > > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; >> > > > >> > > >-- >> > > >- Doug >> > > > >> > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the >> > > >DMCA! >> > > > >> > > > >> > >> > -- >> > - Doug >> > >> > Encrypted with ROT-26 - all attempts to decrypt are illegal under the >> > DMCA! >> > > > > > From tcpeter at mindspring.com Mon Feb 5 19:29:31 2001 From: tcpeter at mindspring.com (tcpeter@mindspring.com) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question Message-ID: > This was quite an email day for me. Offended a new guy and > confused everyone else. :) That's what I get for being in a > hurry. No offense taken, Doug. You scared the crap out of me, though! I struggle with regex's sometimes and thought I missed something seriously (and obviously) brain-damaged with mine. Uh, I didn't, did I? Seriously, thanks for the *warm* welcome! ;-) From chaosppp at corp.earthlink.net Mon Feb 5 22:11:22 2001 From: chaosppp at corp.earthlink.net (Phil Hartfield) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question In-Reply-To: <3.0.6.32.20010205172545.0079e390@pop.phnx.uswest.net> from "Anthony Nemmer" at Feb 05, 2001 05:25:45 PM Message-ID: <200102060411.VAA14524@asylum.phx3.mindspring.net> Yeah huh. Long live the large corporations of the world. ::sigh:: Phil Anthony Nemmer wrote: > > > MindSpring, R.I.P. ;-) > > At 04:53 PM 2/5/01 -0700, you wrote: > >At 03:36 PM 2/5/01 -0700, you wrote: > >>Heh, had to look that up in the > Jargon > >>Dictionary > >> > >>TMTOWTDI, MBIIYS CTLB > >> > >>Phil Hartfield > >> ________ > >>/ \ > >>|GoStats | > >>| | > >>| R.I.P. | > >>| | > >>|Dec 2000| > >>---------- > > > >This was quite an email day for me. Offended a new guy and confused > >everyone else. :) That's what I get for being in a hurry. So what is > >GoStats? > > > >>Doug Miles wrote: > >> > > >> > Anthony Nemmer wrote: > >> > > > >> > > Jesus, Doug. =) > >> > > >> > Sorry. That wasn't what I meant. I was just saying TMTOWTDI and > >> > welcome to the mailing list! > >> > > >> > > At 01:07 PM 2/5/01 -0700, you wrote: > >> > > >tcpeter@mindspring.com wrote: > >> > > >> > >> > > >> On Fri, 2 Feb 2001, Doug Miles wrote: > >> > > >> > >> > > >> > This is probably something obvious, > >> > > >> > >> > > >> I don't think so... > >> > > >> > >> > > >> > but I don't have my regex book with > >> > > >> > me, and can't seem to figure it out. I'm trying to parse space > >> > > >> > delimited information, somewhat like the UNIX command > >> line. Whitespace > >> > > >> > delimits parameters, but parameters can containg whitespace if > >> > > >> > surrounded by quotes. Here's the code: > >> > > >> > > >> > > >> > #!/usr/bin/perl > >> > > >> > > >> > > >> > my $string = qq(DailyNAV "Class C" nav); > >> > > >> > > >> > > >> > my @tokens = $string =~ /(\S+)/g; > >> > > >> > my @tokens = $string =~ /"([^"]+)"/g; > >> > > >> > >> > > >> > my @tokens = $string =~ /"([^"]+)"|(\S+)/g; > >> > > >> > print join('|', @tokens) . "\n"; > >> > > >> > > >> > > >> > here is the output: > >> > > >> > > >> > > >> > DailyNAV|"Class|C"|nav > >> > > >> > Class C > >> > > >> > |DailyNAV|Class C|||nav > >> > > >> > >> > > >> Doug, > >> > > >> I've been sorta lurking here a long time reading, but this is the > >> first > >> > > time I've contributed. This seems to work. It's really the same as > >> one of > >> > > yours, with just a bit of tweaking. > >> > > > > >> > > >I'll be nice since you're a first time poster. :) > >> > > > > >> > > >> > >> > > >> #!/usr/bin/perl > >> > > >> > >> > > >> my $string = qq(DailyNAV "Class C" nav); > >> > > >> print join('|', split(/\s?"([^"]+)"\s?/, $string))."\n"; > >> > > > > >> > > >-- > >> > > >- Doug > >> > > > > >> > > >Encrypted with ROT-26 - all attempts to decrypt are illegal under the > >> > > >DMCA! > >> > > > > >> > > > > >> > > >> > -- > >> > - Doug > >> > > >> > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > >> > DMCA! > >> > > > > > > > > > > From doug.miles at bpxinternet.com Tue Feb 6 14:21:16 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: Message-ID: <3A805CBC.1EB8FDDD@bpxinternet.com> tcpeter@mindspring.com wrote: > > > This was quite an email day for me. Offended a new guy and > > confused everyone else. :) That's what I get for being in a > > hurry. > > No offense taken, Doug. You scared the crap out of me, though! I struggle with regex's sometimes and thought I missed something seriously (and obviously) brain-damaged with mine. Uh, I didn't, did I? I'm glad. I'm really a nice person, no matter what Scott and Kurt say about me. (Hi guys!). Nope, works just fine! > Seriously, thanks for the *warm* welcome! ;-) -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From whitneyt at agcs.com Wed Feb 7 12:50:40 2001 From: whitneyt at agcs.com (Thomas Whitney) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> <3A7B569A.5C8E9494@inficad.com> <3A7B6889.B32B9178@agcs.com> <3A7F07AF.5A057A54@bpxinternet.com> Message-ID: <3A819900.43E5F877@agcs.com> OK, this is my best guess. Quite the hack, and I am sure I missed something, but I have spent way too much time on it ;) my $string = 'DailyNAV "Print STDERR \"$c\"" nav 1 2 3'; my @list = map {($x=$_)=~s/\\"/"/g?$x:$x?$x:()} $string =~ /"((?:\\"|.)*?)"|(\S+)/g; print "$string\n"; print ((join ',',@list),"\n"); BTW: I probably should have introduced myself as a new poster :) Thanks Tom Doug Miles wrote: > Thomas Whitney wrote: > > > > How about? > > > > my @list = $string =~ /(".*?"|\S+)/g; > > I was trying to avoid getting the quotes back also. > > > I think it is faster without the non greedy though? > > > > What is happening with /"([^"]+)"/g; How does this work? > > That globaly matches any sequence of a quote followed by one or more > non-quotes followed by a quote. > > > What about with escapes? > > > > my $string = 'DailyNAV "Print \"C\"" nav'; > > > > my @list = $string =~ /("(?:\\"|.)*?"|\S+)/g; > > I might do this in the future, but I was trying to come up with a > non-complicated test case. :) > > > > > Michael Dearman wrote: > > > > > Love a good regex mystery. This one still just that. > > > > > > Using the no-paren-mem operater with your last regex appears to do away with the nulls. > > > my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; > > > > > > Why? *shrug* > > > Mike D. > > -- > - Doug > > Encrypted with ROT-26 - all attempts to decrypt are illegal under the > DMCA! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/phoenix-pm/attachments/20010207/b75d0624/attachment.htm From doug.miles at bpxinternet.com Wed Feb 7 14:43:27 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Regex question References: <3A7B137A.BC3D07DC@bpxinternet.com> <3A7B569A.5C8E9494@inficad.com> <3A7B6889.B32B9178@agcs.com> <3A7F07AF.5A057A54@bpxinternet.com> <3A819900.43E5F877@agcs.com> Message-ID: <3A81B36F.A5E933A@bpxinternet.com> Thomas Whitney wrote: > > OK, this is my best guess. Quite the hack, and I am sure I missed > something, but I have spent way too much time on it ;) > > my $string = 'DailyNAV "Print STDERR \"$c\"" nav 1 2 3'; > my @list = map {($x=$_)=~s/\\"/"/g?$x:$x?$x:()} $string =~ > /"((?:\\"|.)*?)"|(\S+)/g; > > print "$string\n"; > print ((join ',',@list),"\n"); > > BTW: I probably should have introduced myself as a new poster :) I'll have to spend a couple of minutes on this one. :) Thanks! > > Doug Miles wrote: > > > Thomas Whitney wrote: > > > > > > How about? > > > > > > my @list = $string =~ /(".*?"|\S+)/g; > > > > I was trying to avoid getting the quotes back also. > > > > > I think it is faster without the non greedy though? > > > > > > What is happening with /"([^"]+)"/g; How does this work? > > > > That globaly matches any sequence of a quote followed by one or more > > > > non-quotes followed by a quote. > > > > > What about with escapes? > > > > > > my $string = 'DailyNAV "Print \"C\"" nav'; > > > > > > my @list = $string =~ /("(?:\\"|.)*?"|\S+)/g; > > > > I might do this in the future, but I was trying to come up with a > > non-complicated test case. :) > > > > > > > > Michael Dearman wrote: > > > > > > > Love a good regex mystery. This one still just that. > > > > > > > > Using the no-paren-mem operater with your last regex appears to > > do away with the nulls. > > > > my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g; > > > > > > > > Why? *shrug* > > > > Mike D. > > > > -- > > - Doug > > > > Encrypted with ROT-26 - all attempts to decrypt are illegal under > > the > > DMCA! -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From doug.miles at bpxinternet.com Mon Feb 12 14:34:14 2001 From: doug.miles at bpxinternet.com (Doug Miles) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town Message-ID: <3A8848C6.9C35A1FB@bpxinternet.com> I'll be out of town for the rest of the week if anyone cares. :) I'm planning on having a meeting the 20th, but I'll make the official announcement when I get back. -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From Bryan.Lane at VITALPS.COM Mon Feb 12 14:33:33 2001 From: Bryan.Lane at VITALPS.COM (Bryan Lane) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town Message-ID: <219B26AF200FD411A11200805FE6EF25F2129E@tef00021.vitalps.com> I care!!! I'll talk to you when you get back though. Nothing too urgent. -----Original Message----- From: doug.miles@bpxinternet.com [mailto:doug.miles@bpxinternet.com] Sent: Monday, February 12, 2001 1:34 PM To: Phoenix.pm Subject: Phoenix.pm: Out of Town I'll be out of town for the rest of the week if anyone cares. :) I'm planning on having a meeting the 20th, but I'll make the official announcement when I get back. -- - Doug Encrypted with ROT-26 - all attempts to decrypt are illegal under the DMCA! From whitneyt at agcs.com Mon Feb 12 15:07:52 2001 From: whitneyt at agcs.com (Thomas Whitney) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town References: <3A8848C6.9C35A1FB@bpxinternet.com> Message-ID: <3A8850A8.5ABA22B0@agcs.com> Hi all, I am using Xemacs in Linux as an editor and I use syntax highlighting. When I edit Perl modules with imbedded documentation the colors get messed up. It appears that it can't handle quotes between the documentation tags. It also colors some reserved words between the documentation tags. Does anybody know how to fix this, or am I missing something? Thanks Tom From root at slowass.net Mon Feb 12 17:36:00 2001 From: root at slowass.net (Scott Walters) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town In-Reply-To: <3A8850A8.5ABA22B0@agcs.com> Message-ID: Thomas, Ya got me there! I use nvi myself and abhor syntax highlighting ;) I do however like Lisp, but I don't know my way around Emacs and Emacs Lisp, which is where the fix would need to be. So, anyway you look at me, I'm useless =) -scott On Mon, 12 Feb 2001, Thomas Whitney wrote: > Hi all, > > I am using Xemacs in Linux as an editor and I use syntax highlighting. > When I edit Perl modules with imbedded documentation the colors get > messed up. It appears that it can't handle quotes between the > documentation tags. It also colors some reserved words between the > documentation tags. Does anybody know how to fix this, or am I missing > something? > > Thanks > Tom > > From mdearman at inficad.com Mon Feb 12 18:09:27 2001 From: mdearman at inficad.com (Michael Dearman) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town References: <3A8848C6.9C35A1FB@bpxinternet.com> <3A8850A8.5ABA22B0@agcs.com> Message-ID: <3A887B37.378C7574@inficad.com> Thomas Whitney wrote: > > Hi all, > > I am using Xemacs in Linux as an editor and I use syntax highlighting. > When I edit Perl modules with imbedded documentation the colors get > messed up. It appears that it can't handle quotes between the > documentation tags. It also colors some reserved words between the > documentation tags. Does anybody know how to fix this, or am I missing > something? > > Thanks > Tom Hi Tom, In emacs I managed some small changes to a php module. You have to grok a bit of Lisp. Don't know how Xemacs does this, but there should be some info on a website. Or maybe there's a new version of the module your using with the fix already made. MD From edelweiss at qwest.net Mon Feb 12 17:42:27 2001 From: edelweiss at qwest.net (Anthony Nemmer) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town In-Reply-To: <3A8850A8.5ABA22B0@agcs.com> References: <3A8848C6.9C35A1FB@bpxinternet.com> Message-ID: <3.0.6.32.20010212164227.007b8100@pop.phnx.qwest.net> At 02:07 PM 2/12/01 -0700, you wrote: >Hi all, > >I am using Xemacs in Linux as an editor and I use syntax highlighting. >When I edit Perl modules with imbedded documentation the colors get >messed up. It appears that it can't handle quotes between the >documentation tags. It also colors some reserved words between the >documentation tags. Does anybody know how to fix this, or am I missing >something? > >Thanks >Tom > > > I prefer Nirvana Edit (nedit) to emacs, or Xemacs. You can get nedit at http://nedit.org/ Tony From eden.li at asu.edu Mon Feb 12 21:02:40 2001 From: eden.li at asu.edu (Eden Li) Date: Thu Aug 5 00:16:21 2004 Subject: Phoenix.pm: Out of Town In-Reply-To: <3.0.6.32.20010212164227.007b8100@pop.phnx.qwest.net>; from edelweiss@qwest.net on Mon, Feb 12, 2001 at 04:42:27PM -0700 References: <3A8848C6.9C35A1FB@bpxinternet.com> <3A8850A8.5ABA22B0@agcs.com> <3.0.6.32.20010212164227.007b8100@pop.phnx.qwest.net> Message-ID: <20010212200240.A875@asu.edu> hmm.. smells like teen spirit..... *ducks* On Mon, Feb 12, 2001 at 04:42:27PM -0700, Anthony Nemmer wrote: > I prefer Nirvana Edit (nedit) to emacs, or Xemacs. You can get nedit at