RE: RegEx: Finding and replacing all characters between ( and ) ?
Ok while (){ print; print "becomes\n"; s/\([^\(\)]+\)|\(\(\)\)/()/g; print; print "\n"; } __DATA__ asdf(asdf)asdf asdf((asdf))asdf asdf(as(asdf)df)asdf prints-- asdf(asdf)asdf becomes asdf()asdf asdf((asdf))asdf becomes asdf(())asdf asdf(as(asdf)df)asdf becomes asdf(as()df)asdf - so, while what? - -Original Message- From: Joseph P. Discenza [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 8:53 AM To: Ron Hartikka; perl win32 users Subject: RE: RegEx: Finding and replacing all characters between ( and ) ? Ron Hartikka wrote, on Thursday, June 07, 2001 8:33 AM : Can the () in your data be nested? : : If so, you can't use an re. (See: How do I find matching/nesting anything? : in perlfaq 4.) For example, : : while (){ : : print; : print "becomes\n"; : s/\([^\)]+\)/()/g; # as Bill suggests What if you make it s/\([^\(\)]+\)|\(\(\)\)/()/g; ? You could also stick that in a while, print it at each iteration, and watch the innermost parenthetical expressions disappear. Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 219.243.6040 ext. 300fax: 219.243.6060 Providing Financial Solutions and Compliance for over 30 Years ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Web interaction...
Craig, Could you be a little more specific than "I could not use [it] at another"? What happened? What error message did you get? You are running with strict and warnings turned on, right? Also, perl -e "use Http::Request::Form;" from the command line is a quick way of seeing if a given package is installed. Merrill ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: RegEx: Finding and replacing all characters between ( and ) ?
Ron Hartikka wrote, on Thursday, June 07, 2001 8:33 AM : Can the () in your data be nested? : : If so, you can't use an re. (See: How do I find matching/nesting anything? : in perlfaq 4.) For example, : : while (){ : : print; : print "becomes\n"; : s/\([^\)]+\)/()/g; # as Bill suggests What if you make it s/\([^\(\)]+\)|\(\(\)\)/()/g; ? You could also stick that in a while, print it at each iteration, and watch the innermost parenthetical expressions disappear. Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTECTED] Carleton Inc. http://www.carletoninc.com 219.243.6040 ext. 300fax: 219.243.6060 Providing Financial Solutions and Compliance for over 30 Years ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Web interaction...
Hello all, I am new to the web interaction space. I looked up the topic in the docs and found Http::Request::Form. I tried that, and it worked on the machine that I was working on at that moment (work at multiple locations). I then noticed that I could not use at another. I thought maybe I did not have the same packages loaded, but I do. I was a little confused about the inconsistency. Can anyone point me to a good source for web interaction (e.g. not making, but using forms on the web, etc.)? I would like to write a script that visits a particular site every so often, and fills out a particular form automatically. Thanks in advance. Craig [EMAIL PROTECTED] Pager Numeric: 1-877-895-3558 Email pager: [EMAIL PROTECTED] -- You will never find time for anything. If you want time, you must make it. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: RegEx: Finding and replacing all characters between ( and ) ?
Charles, Can the () in your data be nested? If so, you can't use an re. (See: How do I find matching/nesting anything? in perlfaq 4.) For example, while (){ print; print "becomes\n"; s/\([^\)]+\)/()/g; # as Bill suggests print; print "\n"; } __DATA__ asdf(asdf)asdf asdf((asdf))asdf has the output... asdf(asdf)asdf becomes asdf()asdf asdf((asdf))asdf becomes asdf())asdf I think you can use an re if you hard code a limit to the number of nests. If you know there are no nested () you can use the re above. If you know there is a limit to the nest depth, post the limit. If you want to do unlimited nesting, you have to write a parser. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of $Bill Luebkert Sent: Thursday, June 07, 2001 12:35 AM To: Charles Wilson (h) Cc: [EMAIL PROTECTED] Subject: Re: RegEx: Finding and replacing all characters between ( and ) ? "Charles Wilson (h)" wrote: > > I have been studying how to use Regular Expressions within my text editor (Allaire's Coldfusion > Studio- AKA Homesite). > > Specifically, I would like to find a left parenthese '(' then find a right parenthese ')' in a file, > and then delete out any amount of characters between the parentheses. I'm sure that using a Regular > Expression to match the characters would be best, but I have tried all different types of > expressions such as: > > ((**)) > or > ((*.*.*.*.*.*.)) > > but it doesen't seem to work. > > Does anyone have any ideas? Untested: s/\([^\)]+\)/()/g; # replace (...) with () multiple times (g) -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / )// // DBE Collectibles http://www.todbe.com/ / ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/ -/-' /___/_<_http://www.freeyellow.com/members/dbecoll/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: win98 crash
Hello Tom, Tuesday, June 05, 2001, 7:10:04 PM, you wrote: TN> I am trying to run Komodo under windows. As soon as I load a perl TN> script, the entire system crashes? TN> Any thoughts? TN> Tom Noack TN> ___ TN> Perl-Win32-Users mailing list TN> [EMAIL PROTECTED] TN> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users I experienced this problem while running Norton Antivirus Corporate Edition realtime scanning. The machine would just reboot whenever I tried to open a script in Komodo. It also occurred running certain scripts, as well as compiling some programs. I submitted a bug report to both Komodo and Norton. Norton, of course, replied that programmers should turn off realtime scans every time they compile a program... (not very convenient for perl developers, eh?) Therefore, realtime scans are permanently disabled on my machine... Best regards, ryddler [EMAIL PROTECTED] www.cu-online.com/~ryddler/conquest ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Regex Question: splitting at a point unless part of a quoted substring
Lee Goddard wrote: > > > Lee Goddard wrote: > > > > > > > > I need to split a string at all full-stops '.' > > > > > unless they are part of a sub-string within quotes. > > > > > > > > > > Should I manually loop over the file, setting flags, > > > > > or can I do this with a regular expression? > > > > > > > > And of course, I need to have escaped single-quotes too, > > > > \' > > > > > > In other words, can anyone put this into a regex?! > > > > > > $file = "Split now. Quoting so do not split \\'here. \\', but now. Do not >'fullstop.' but now. And again. Finally."; > > > > > > for (my $i=0; $i > > my $c = substr($file,$i,1); > > > if ($c eq '\\'){ $out .= $c; next } > > > if ($c eq "'") { $q = not $q } > > > if ($c eq "." and not $q) { $c .= "\n" } > > > $out .= $c; > > > } > > > > > > warn $out; > > > > Assuming you really wouldn't have a ' ' after the here. since it's in quotes > > (if it's possible, you could add a check for [^'] after the \s+): > > > > my $file = "Split now. Quoting so do not split 'here.', but now. Do not >'fullstop.' but now. And again. Finally."; > > > > $file =~ s/(?:^|\G)(.*?\.)(?:\s+|\s*$)/$1\n/g; > > print $file, "\n"; > > Many thanks, Bill. I kinda hoped you'd be out there today > > ?: is news to me: off to perldoc perlre. > > But, things got a lot more complex when I realised that quotes > can also be round or square brackets, and so I'm saving programming > time by doing a loop with flags. You would think that if the substr is in ', ", ) or ] that there would be no space before the closing quote. So it shouldn't matter. You could remove the space before the quote first and then run the above RE. -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / )// // DBE Collectibles http://www.todbe.com/ / ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/ -/-' /___/_<_http://www.freeyellow.com/members/dbecoll/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Regex Question: splitting at a point unless part of a quoted substring
> Lee Goddard wrote: > > > > > > I need to split a string at all full-stops '.' > > > > unless they are part of a sub-string within quotes. > > > > > > > > Should I manually loop over the file, setting flags, > > > > or can I do this with a regular expression? > > > > > > And of course, I need to have escaped single-quotes too, > > > \' > > > > In other words, can anyone put this into a regex?! > > > > $file = "Split now. Quoting so do not split \\'here. \\', but now. Do not >'fullstop.' but now. And again. Finally."; > > > > for (my $i=0; $i > my $c = substr($file,$i,1); > > if ($c eq '\\'){ $out .= $c; next } > > if ($c eq "'") { $q = not $q } > > if ($c eq "." and not $q) { $c .= "\n" } > > $out .= $c; > > } > > > > warn $out; > > Assuming you really wouldn't have a ' ' after the here. since it's in quotes > (if it's possible, you could add a check for [^'] after the \s+): > > my $file = "Split now. Quoting so do not split 'here.', but now. Do not 'fullstop.' >but now. And again. Finally."; > > $file =~ s/(?:^|\G)(.*?\.)(?:\s+|\s*$)/$1\n/g; > print $file, "\n"; Many thanks, Bill. I kinda hoped you'd be out there today ?: is news to me: off to perldoc perlre. But, things got a lot more complex when I realised that quotes can also be round or square brackets, and so I'm saving programming time by doing a loop with flags. Cheers, Lee ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Help on subctitution s///
open IN, 'in.xml'; open OUT, '>temp.xml'; while () { s/\s*<\/NAME>/<\/NAME>/; print OUT; } unlink 'in.xml'; rename 'temp.xml', 'in.xml'; > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Saxena, Saurabh > Sent: Thursday, June 07, 2001 1:16 PM > To: 'Perl2'; 'Perl1' > Subject: Help on subctitution s/// > > > > I have a XML file which looks like > "... > Saurabh > .." > > I want to remove the whitespace in the TAG value. I am using > > while (<>) > { > s/\s*<\/NAME>/<\/NAME>/; -->This will replace the > with > print 4_; > } > > On the console it is showing the value as > > "... > Saurabh > .." > > but the file is not touched. > > Now is it possible by any method to replace the whitespace on the file > itself. Like open the file then replace the with > on the file itself and then close the file > > regards > Saurabh > > > > > > > > ___ > ActivePerl mailing list > [EMAIL PROTECTED] > http://listserv.ActiveState.com/mailman/listinfo/activeperl ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Help on subctitution s///
(1) Use XML::TokeParser. (2) Use XML::TokeParser. (3) Use XML::TokeParser. Lee > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Saxena, Saurabh > Sent: 07 June 2001 12:16 > To: 'Perl2'; 'Perl1' > Subject: Help on subctitution s/// > > > > I have a XML file which looks like > "... > Saurabh > .." > > I want to remove the whitespace in the TAG value. I am using > > while (<>) > { > s/\s*<\/NAME>/<\/NAME>/; -->This will replace the > with > print 4_; > } > > On the console it is showing the value as > > "... > Saurabh > .." > > but the file is not touched. > > Now is it possible by any method to replace the whitespace on the file > itself. Like open the file then replace the with > on the file itself and then close the file > > regards > Saurabh > > > > > > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
(no subject)
read print 4_ as print $_ in my previous mail regards Saurabh ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Help on subctitution s///
I have a XML file which looks like "... Saurabh .." I want to remove the whitespace in the TAG value. I am using while (<>) { s/\s*<\/NAME>/<\/NAME>/; -->This will replace the with print 4_; } On the console it is showing the value as "... Saurabh .." but the file is not touched. Now is it possible by any method to replace the whitespace on the file itself. Like open the file then replace the with on the file itself and then close the file regards Saurabh ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Regex Question: splitting at a point unless part of a quoted substring
Lee Goddard wrote: > > > > I need to split a string at all full-stops '.' > > > unless they are part of a sub-string within quotes. > > > > > > Should I manually loop over the file, setting flags, > > > or can I do this with a regular expression? > > > > And of course, I need to have escaped single-quotes too, > > \' > > In other words, can anyone put this into a regex?! > > $file = "Split now. Quoting so do not split \\'here. \\', but now. Do not >'fullstop.' but now. And again. Finally."; > > for (my $i=0; $i my $c = substr($file,$i,1); > if ($c eq '\\'){ $out .= $c; next } > if ($c eq "'") { $q = not $q } > if ($c eq "." and not $q) { $c .= "\n" } > $out .= $c; > } > > warn $out; Assuming you really wouldn't have a ' ' after the here. since it's in quotes (if it's possible, you could add a check for [^'] after the \s+): my $file = "Split now. Quoting so do not split 'here.', but now. Do not 'fullstop.' but now. And again. Finally."; $file =~ s/(?:^|\G)(.*?\.)(?:\s+|\s*$)/$1\n/g; print $file, "\n"; -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / )// // DBE Collectibles http://www.todbe.com/ / ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/ -/-' /___/_<_http://www.freeyellow.com/members/dbecoll/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Regex Question: splitting at a point unless part of a quoted substring
> > I need to split a string at all full-stops '.' > > unless they are part of a sub-string within quotes. > > > > Should I manually loop over the file, setting flags, > > or can I do this with a regular expression? > > And of course, I need to have escaped single-quotes too, > \' In other words, can anyone put this into a regex?! $file = "Split now. Quoting so do not split \\'here. \\', but now. Do not 'fullstop.' but now. And again. Finally."; for (my $i=0; $ihttp://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Regex Question: splitting at a point unless part of a quoted substring
> I need to split a string at all full-stops '.' > unless they are part of a sub-string within quotes. > > Should I manually loop over the file, setting flags, > or can I do this with a regular expression? And of course, I need to have escaped single-quotes too, \' Thanks in anticipation... lee ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Regex Question: splitting at a point unless part of a quoted substring
> -Original Message- > From: Lee Goddard [mailto:[EMAIL PROTECTED]] > Sent: 07 June 2001 11:14 > To: Perl_Users > Subject: Regex Question: splitting at a point unless part of a quoted > substring > I need to split a string at all full-stops '.' > unless they are part of a sub-string within quotes. > Should I manually loop over the file, setting flags, > or can I do this with a regular expression? If it is safe to assume all quotes are safe to use i.e. not escaped somehow then a regex will suffice or perhaps the use of the balanced text module (I forget the name, prolly Text::Balanced). Michael Erskine (MSEmtd) mailto:[EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Regex Question: splitting at a point unless part of a quoted substring
I need to split a string at all full-stops '.' unless they are part of a sub-string within quotes. Should I manually loop over the file, setting flags, or can I do this with a regular expression? Thanks in anticipation, lee ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: problems with perlcc - news
From: "Sisyphus" <[EMAIL PROTECTED]> > I'm running perl compiled from AS build 626 (5.6.1) source on Win 2k. thank you Sisyphus. I have no luck with your script. I have a question for you: what compiler did you use to compile the AS 5.6.1 on your system? Probabily you use Visual C. I use Borland Builder 4.0 Pro. Anyway I downloaded the binary package of AS and when I look at the version of my perl: #perl -V i get the following: // starts here --- [...] Compiler: cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX', optimize='-O1 -MD -DNDEBUG', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define [...]. //--- stops here - you can see from the section Compiler there is a command specified, so probabily that it means'cl' is the compiler required on my system to make perlcc building the exe file May I instruct my AS to use BB as a compiler? Thank you in advance Claves. P.S. I send a copy of this to the AS m.list. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Syllables in words
IF it was *you* interested in this topic but without time to check it out, sorry I lost your name and e-mail, but - the existing module Lingua::EN::Syllable is so inaccurate that I grabbed some freeware rhyming dictionary files that contain syllable counts, and put them in an SQL db with perl interface. On CPAN as Lingua::Syllable (sometime today). Be warned that it requires both Lingua::EN::Syllable as a fall-back, and Lingua::Rhyme, which is large. cheers lee Lee Goddardhttp://www.leegoddard.com Perl / XML / XSLT / Java / AI MIDI Music ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Revised: Symbolic References & "use strict;"
-- tried to send this yesterday - no luck. Here goes again use strict; use vars qw($one $two); $one = "two"; $two = "two"; { no strict "refs"; # turns off strict refs for the scope of the enclosing block print ${$one}; # prints out "two" } print ${$one}; # blows up HTH, Nikhil. -Original Message- From: Andy td [mailto:[EMAIL PROTECTED]] Sent: 05 June 2001 22:03 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Revised: Symbolic References & "use strict;" Hi! I'm writing a program that uses "use strict;" (which requires the variable to be declared before it's can be used) and symbolic references (e.g. $$cmd{$ext}++;). When I run the program, I get the error saying I must declare the variable $$cmd first. Please let me know can I solve this problem without removing "use strict;" from my program. Thanks, Andy ___ Send a cool gift with your E-Card http://www.bluemountain.com/giftcenter/ ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users For more information about Barclays Capital, please visit our web site at http://www.barcap.com. Internet communications are not secure and therefore the Barclays Group does not accept legal responsibility for the contents of this message. Although the Barclays Group operates anti-virus programmes, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Barclays Group. Replies to this email may be monitored by the Barclays Group for operational or business reasons. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: problems with perlcc - news
From: "Joe Schell" <[EMAIL PROTECTED]> To: "Claves do Amaral" <[EMAIL PROTECTED]>; You did uninstall the older version first right? bingo! now it works. #perlcc.bat formatta_ama.pl still gives problems, but if I use #perl -MO=CC formatta_ama.pl I get the desired result, i.e. a file written in C code Now I'm going to compile... it will be hard. Claves [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Installing packages
> How can i install for ex. DBI and DBD packages in a computer with no > Internet Connection? You download the modules from http://www.activestate.com/PPMPackages/zips/6xx-builds-only/ copy them somehow to the computer in question, unpack the ZIPs to some temporary directory, set ppm repository to that directory and install them via PPM. PPM> set repository --remove ActiveState Package Repository PPM> set repository Local c:\perl\download PPM> set save PPM> install DBI HTH, Jenda == [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == : What do people think? What, do people think? :-) -- Larry Wall in <[EMAIL PROTECTED]> ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users