[30043] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1286 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 18 14:09:42 2008

Date: Mon, 18 Feb 2008 11:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 18 Feb 2008     Volume: 11 Number: 1286

Today's topics:
    Re: bash and perl <dw149@acmex.gatech.edu>
    Re: bash and perl <joost@zeekat.nl>
    Re: bash and perl <thepoet_nospam@arcor.de>
    Re: bash and perl <cartercc@gmail.com>
    Re: Looking for an integrated mailing-list / web-forum  <arifsaha@yahoo.com>
        LWP::UserAgent::request: Simple response: Not Found <phillip.s.powell@gmail.com>
    Re: Parsing multi-line text <noreply@gunnar.cc>
    Re: Parsing multi-line text keith@bytebrothers.co.uk
    Re: Parsing multi-line text <noreply@gunnar.cc>
    Re: Regular Expression to Replace UPPER Case Text with  <riad.kaced@gmail.com>
    Re: Regular Expression to Replace UPPER Case Text with  <cartercc@gmail.com>
    Re: Regular Expression to Replace UPPER Case Text with  <cwilbur@chromatico.net>
    Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Ka cokofreedom@gmail.com
    Re: unicode <-> hex <joost@zeekat.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 18 Feb 2008 13:53:04 +0000 (UTC)
From: David Williams <dw149@acmex.gatech.edu>
Subject: Re: bash and perl
Message-Id: <fpc2k0$7tf$1@news-int.gatech.edu>

Hello all,
I'm just trying to send mail using the mail command.  
I would use perl but sendmail is not running and so
far all I see in the perl modules is sendmail.  is there 
a postfix module?



-- 
David Williams
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: dw149@prism.gatech.edu


------------------------------

Date: Mon, 18 Feb 2008 15:12:37 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: bash and perl
Message-Id: <87pruufj56.fsf@zeekat.nl>

David Williams <dw149@acmex.gatech.edu> writes:

> Hello all,
> I'm just trying to send mail using the mail command.  
> I would use perl but sendmail is not running and so
> far all I see in the perl modules is sendmail.

MIME::Lite does sendmail and SMTP.

>  is there 
> a postfix module?

Doesn't postfix speak SMTP?

ps: You should start a new thread for new issues. Please don't post them
as replies to an unrelated question.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


------------------------------

Date: Mon, 18 Feb 2008 15:43:53 +0100
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: bash and perl
Message-Id: <47b999a9$0$2305$9b4e6d93@newsspool4.arcor-online.net>

David Williams wrote:
> I'm just trying to send mail using the mail command.  
> I would use perl but sendmail is not running and so
> far all I see in the perl modules is sendmail.  is there 
> a postfix module?

Postfix (like every other fully-fledged smtp server software
on *nix) comes with a sendmail-compatible command line binary
with the name "sendmail". So you can simply use Email::Send
or any other module that uses sendmail from the command line.

-Chris


------------------------------

Date: Mon, 18 Feb 2008 07:46:20 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: bash and perl
Message-Id: <ea349a21-d56f-4426-bcf7-20f635ad0712@e6g2000prf.googlegroups.com>

On Feb 18, 8:53 am, David Williams <dw...@acmex.gatech.edu> wrote:
> Hello all,
> I'm just trying to send mail using the mail command.
> I would use perl but sendmail is not running and so
> far all I see in the perl modules is sendmail.  is there
> a postfix module?

The Perl sendmail module doesn't use sendmail. I know it's confusing,
but you can use Perl sendmail to send mail even on a server that's not
running sendmail.

see the documentation for mail::sendmail, a simple platform
independent mailer.

CC


------------------------------

Date: Mon, 18 Feb 2008 11:05:09 -0500
From: S P Arif Sahari Wibowo <arifsaha@yahoo.com>
Subject: Re: Looking for an integrated mailing-list / web-forum (BB) engine
Message-Id: <alpine.OSX.1.00.0802181103000.277@imac2006.local>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-320261352-1203350711=:277
Content-Type: TEXT/PLAIN; charset=ISO-2022-JP

Hi!

Anybody has any suggestion? So far I only found RForum 
<http://rforum.andreas-s.net/> in Ruby in Rails. Any Perl 
solution?

I am looking for a perl solution which provide integrated 
mailing-list manager and web-forum (discussion / message / 
bulletin board). Basically where people can join & participate 
both by e-mail and by web access, similar to non-usenet Google 
Groups and YahooGroups.

The solution does not need to be a single application, but 
should be integrated. Specifically, it should do these:

- Member can participate in the forum fully by e-mail only 
(subscribe, confirm, post, and unsubscribe by e-mail).

- Member can participate (post) in the forum by web interface.

- Participation by web interface need authentication (login with 
some brute force hacking avoidance, e.g. captcha).

- Posting by e-mail will show up in the web interface and 
delivered to all member choose to receive posting by e-mail.

- Posting by web interface will show up in the web interface and 
delivered to all member choose to receive posting by e-mail.

- Membership from e-mail wil be the same as membership from web 
interface, or at least synchronized.


Any idea?

Thanks!

-- 
                             (stephan paul) Arif Sahari Wibowo
   _____  _____  _____  _____
  /____  /____/ /____/ /____
 _____/ /      /    / _____/      http://www.arifsaha.com/

Xinnian Kuaile! 新年快樂 Gongxi Facai 恭喜發財
--0-320261352-1203350711=:277--


------------------------------

Date: Mon, 18 Feb 2008 08:09:07 -0800 (PST)
From: Phil Powell <phillip.s.powell@gmail.com>
Subject: LWP::UserAgent::request: Simple response: Not Found
Message-Id: <2f111c69-f8f8-4b71-88df-ed0e2c18e0c7@s8g2000prg.googlegroups.com>

I am using WWW::Mechanize to scrape from https://blah.foo.www.domain.com/main/index.html,
which is a secured site that can only be obtained via Netegrity
Siteminder-based authentication via https://blah.foo.www.domain.com/registration/login.html

So this is what normally happens if you go manually:

1) you type in https://blah.foo.www.domain.com/main/index.html
2) You are not detected to be logged in so you're automatically
redirected to https://blah.foo.www.domain.com/registration/login.html
3) You fill out an online form with your username and password
4) You submit, which takes you to https://blah.foo.www.domain.com/login/login.fcc
(Siteminder) which will check out your entry for authentication
5) You are successfully logged in, so on you to go
https://blah.foo.www.domain.com/main/index.html

I have a Perl script that should perform all steps 1 - 5, however it
breaks at 5, never getting to the intended URL due to receiving a 404
Object Not Found error, furthermore, in my LWP Debug statements I get
"LWP::UserAgent::request: Simple response: Not Found".

Here is how I'm trying to do it using Perl:

#!/strawberry/perl/bin/perl

use strict;
use warnings;
use HTTP::Cookies;
use HTTP::Headers;
use WWW::Mechanize;
use LWP::Debug qw(+);

require "C:¥¥Documents and Settings¥¥me¥¥Desktop¥¥subs.pl";

if (my err = read_cfg("C:¥¥Documents and Settings¥¥me¥¥Desktop¥
¥file.cfg")) {
          print(STDERR $err, "¥n");
          exit(1);
}

my $mech = WWW::Mechanize->new();
$mech->agent_alias('Windows IE 6');
$mech->cookie_jar(HTTP::Cookies->new(autosave => 1));
$mech->add_header('UID' => $CFG::cfg{'USERNAME'}, 'cn' =>
$CFG::cfg{'CN'});

# FIRST PART: GO TO INDEX WHICH WILL REDIRECT YOU TO LOGIN AS YOU
HAVEN'T YET
my $response = $mech->get($CFG::cfg{'URL'});
die 'Error at ' , $CFG::cfg{'URL'}, "¥n" $response->status_line, "¥n
Aborting" unless $response->is_success;
print "¥n¥nSUCCESS data type: ", $response->content_type, "¥n¥n";

# SECOND PART: LOGIN FROM LOGIN PAGE WITH USERNAME AND PASSWORD
PROVIDED
$mech->submit_form(
                                 form_number => 1,
                                 fields => {
                                                 USER =>
$CFG::cfg{'USERNAME'},
                                                 PASSWORD =>
$CFG::cfg{'PASSWORD'}
                                 }
); # WILL SUBMIT TO /registration/login_2 TO BUNDLE USERNAME/PASSWORD
TO SEND TO SITEMINDER AGENT

# THIRD PART: GO TO /registration/login_2 TO HANDLE LOGIN REQUEST WITH
FORM ENTRIES
my $content = $mech->content;
my $urlHeader = $CFG::cfg{'URL_HEADER'};
$content =!‾ s[(href=['"]?)(/main)][$1$urlHeader$2]isg;
$mech->update_html($content);
$mech->submit(); # WILL SUBMIT TO SITEMINDER AGENT AND RETURN VERIFIED

$content = $mech->content;

------------------------------------------------------------------------------------------------------------------------------------------

However, it never successfully gets to Step 5), here is the output to
hopefully explain why:

C:¥>perl "C:¥¥Documents and Settings¥¥me¥¥Desktop¥¥file.pl"
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: GET https://blah.foo.www.domain.com/main/i
ndex.html
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: GET https://blah.foo.www.domain.com/registration/login_
1?
TYPE=33554432&REALMOID=06-3fc2790b-96fd-0006-0000-1e2300001e23&GUID=&SMAUTHREA
SON=0&METHOD=GET&SMAGENTNAME=$SM$NKtSpmLX2VhxLeg5Fc91DK221%2bP2Wf
%2bMwczu%2fbNNC
LE%3d&TARGET=$SM$https%3a%2f%2fblah%2efoo%2ewww%2edomain%2ecom%2fmain
%2f
2f%2findex%2ehtml
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 469 bytes
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: GET https://blah.foo.www.domain.com/registration/login_
1/?
TYPE=33554432&REALMOID=06-3fc2790b-96fd-0006-0000-1e2300001e23&GUID=&SMAUTHRE
ASON=0&METHOD=GET&SMAGENTNAME=$SM$NKtSpmLX2VhxLeg5Fc91DK221%2bP2Wf
%2bMwczu%2fbNN
CLE%3d&TARGET=$SM$https%3a%2f%2frup2%2edev1%2eprime%2eirs%2ecom
%2fsemail%2fviews
%2f%2findex%2ehtml
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 4096 bytes
LWP::Protocol::collect: read 284 bytes
LWP::Protocol::collect: read 4096 bytes
LWP::Protocol::collect: read 619 bytes
HTTP::Cookies::extract_cookies: Set cookie JSESSIONID =>
0000CNUANTLZENJHYTKEG3S
USXQ:10i31rv29
LWP::UserAgent::request: Simple response: OK


SUCCESS data type: text/htmlcharset=ISO8859-1

LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: - checking cookie path=/
HTTP::Cookies::add_cookie_header:  - checking cookie
JSESSIONID=0000CNUANTLZENJH
YTKEG3SUSXQ:10i31rv29
HTTP::Cookies::add_cookie_header:    it's a match
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: POST https://blah.foo.www.domain.com/registration/login
_2/0,,,00.html
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 815 bytes
LWP::UserAgent::request: Simple response: OK
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: - checking cookie path=/
HTTP::Cookies::add_cookie_header:  - checking cookie
JSESSIONID=0000CNUANTLZENJH
YTKEG3SUSXQ:10i31rv29
HTTP::Cookies::add_cookie_header:    it's a match
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: POST https://blah.foo.www.domain.com/login/login.f
cc
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
HTTP::Cookies::extract_cookies: Set cookie FORMCRED => +Jy1O0pLR06/
i8PvjzNJjBkjQ
gIms8tauo/Va9iPbL7dVx2DsUD2UTEg1ebOw
+yVzRzlV3t7ziD8EFjzHX1WYBO50h2gCkRGgk2Z1BVCF
FJ97ixaop+sW3F39bQWPGpanf6nDrJYkzY=
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking blah.foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: - checking cookie path=/
HTTP::Cookies::add_cookie_header:  - checking cookie
JSESSIONID=0000CNUANTLZENJH
YTKEG3SUSXQ:10i31rv29
HTTP::Cookies::add_cookie_header:    it's a match
HTTP::Cookies::add_cookie_header: Checking .foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: - checking cookie path=/
HTTP::Cookies::add_cookie_header:  - checking cookie FORMCRED=
+Jy1O0pLR06/i8Pvjz
NJjBkjQgIms8tauo/Va9iPbL7dVx2DsUD2UTEg1ebOw
+yVzRzlV3t7ziD8EFjzHX1WYBO50h2gCkRGgk
2Z1BVCFFJ97ixaop+sW3F39bQWPGpanf6nDrJYkzY=
HTTP::Cookies::add_cookie_header:    it's a match
HTTP::Cookies::add_cookie_header: Checking foo.www.domain.com for
cookies
HTTP::Cookies::add_cookie_header: Checking .www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking www.domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking domain.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: GET https://blah.foo.www.domain.com/main/i
ndex.html
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 42 bytes
HTTP::Cookies::extract_cookies: Set cookie FORMCRED =>
HTTP::Cookies::extract_cookies: Set cookie smretry_cookie => true
HTTP::Cookies::extract_cookies: Set cookie SMSESSION =>
NffP0fewmFwhTPvRVx/EXE1H
5236J2xl/olTx6HGAv5Hs3pVASSK6Px4J/9kEX5VuYN/f
+XgOIDojsKNrCqFZZK4vPxFtWBWIuifF/n2
VWi0h02TP0TvDPhSQ63uzau1cHPygGFSBSA3qLl+g0S3s/llOT27KR6/
Vz35ddJWxiNHkU4b6f7G6tll
/dKJjH7STmJ5stZNWIglZu7IAgRcnn5S7txqNynNkn9XevKI60q/
yMqTf1oIb5ZrMHRQbXpB3SEkBFyf
COC9AR7/e2+U3qyMSAJ6p6I0iKNB/
GHzwWztJ6pEc1OJNLPE78BV9rXcom0FjWjOopWq3rrGormWKZPa
tVY2K3+GeUfn/5ygqlTzjUycF+8c3v6J/PPGCZ+3bFQvIc8vxtXomCtkTQ4cSnUk/
mR2+MndMD5hK6Wc
SxdaktyUEIF7d621AEvtxXFYVI98cb5a25l6jLWaVrMHN76wPns
+DkitKgwswXyrgCNbGAFEjrgzBMbq
qeFfzDOJXVUvsTuVXPKD2LJYcN4HwaoK1h3Nw+4NUhHGcz9tvisv20zGMMKIkyIMl/
LXVwe8vQ0MCme4
0WFcIzkToDXZsSe7E7Mhk7D9t6u/SE2oeFheS07qyFW217MGTsOgbnN80Mv0N/
g6TsKxTOROB3QTuo43
rXdOmH9zlmxtwP4uJ13KvN8JDtEdj5MK/
kN8ePQtuMK240f3vfcYqzI33nXnfhI2N6hkqo6yyqGjW0dO
RQAMYn5/
qsI0yEbFf2h1oVECf8SMYF2XKEz32uMH9vwPC14FwGJPaVeOgB9QMrFgVFDyzf2xhrODtxcI
Py+oMGxROADxOo1ibIrBEwBKlJlg7moahW0OnZRSF16n8R2yQu6ctuVy2xSGAErXEbWQA
+YeeI+iaavK
GaHyqNaYxv5M95SXg9GPj5H3oD2z1hyouU9JvUTsTGBdM8w2QwVCXcFmarP0Hb9s66YjAJiFPCvNztK8
mwATiJvARlJV76TfVzu86BHD4+sPIWlyoehHDUSoPSaSlU/
SwWV05gFqgx8rNg26zmAchudkqZXFMLx8
JdK80rs8x4JaBiIhNzfXyYzKo/qfm2T4X7D3E4smxdqWF9fzTaXd9ke5Wp/
iCDq9HfEbr0PTBXDpLl8u
YdISKfD9alvHIop8d3JDucRMswbtx3K0Mgx+rQAvKMscAlvHVK/
TzZX6QBRUdvpzl1oWtO3bn3HNjdSv
AFVK7dZCTZVcZw==
HTTP::Cookies::extract_cookies: Set cookie smretry_cookie => true
LWP::UserAgent::request: Simple response: Not Found


------------------------------

Date: Mon, 18 Feb 2008 12:18:33 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Parsing multi-line text
Message-Id: <61t7olF20o3beU1@mid.individual.net>

keith@bytebrothers.co.uk wrote:
> I have a data file structured something like this:
> 
> ------------------8<-----------------------
> Chunk 01
> 	NAME: "Alice"
> 	Description: "Some other string"
> 	Age: 37
> Chunk 02
> 	NAME: "Bob"
> 	Description: "Some other string"
> 	Age: 28
> Chunk 03
> 	FIRST: "Carol"
> 	Description: "Some other string"
> 	Age: 32
> Chunk 04
> 	FIRST: "Dave"
> 	Description: "Some other string"
> 	Age: 22
> ------------------8<-----------------------
> 
> and I want to extract from it to produce output something like this:
> 
> ------------------8<-----------------------
> 01 NAME: Alice    -> 37
> 02 NAME: Bob     -> 28
> 03 NAME: Carol    -> 32
> 04 NAME: Dave    -> 22
> ------------------8<-----------------------

     local $/ = 'Chunk';
     while (<>) {
         if ( /(¥d+).+[A-Z]+:¥s+"([^"]*)".+Age:¥s+(¥d+)/s ) {
             printf "%02d NAME: %-10s -> %d¥n", $1, $2, $3;
         }
     }

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Mon, 18 Feb 2008 03:41:52 -0800 (PST)
From: keith@bytebrothers.co.uk
Subject: Re: Parsing multi-line text
Message-Id: <e9638d75-96c5-42a6-91c7-14c3a4b67af3@k2g2000hse.googlegroups.com>

On 18 Feb, 11:18, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> ke...@bytebrothers.co.uk wrote:
> > I have a data file structured something like this:
>
> > ------------------8<-----------------------
> > Chunk 01
> >    NAME: "Alice"
> >    Description: "Some other string"
> >    Age: 37
> > ------------------8<-----------------------
>
> > and I want to extract from it to produce output something like this:
>
> > ------------------8<-----------------------
> > 01 NAME: Alice    -> 37
> > ------------------8<-----------------------
>
>      local $/ = 'Chunk';
>      while (<>) {
>          if ( /(¥d+).+[A-Z]+:¥s+"([^"]*)".+Age:¥s+(¥d+)/s ) {
>              printf "%02d NAME: %-10s -> %d¥n", $1, $2, $3;
>          }
>      }

Gotta love this place - thanks!

Now, let's see if I can decipher (no point in asking if I don't learn
from the answer)...

You make the text 'Chunk' the record delimiter.  Then inside each
record you look for digits (store in $1). Skip anything followed by
uppercase text followed by colon followed by space followed by double-
quote.  Now grab everything up to next double quote (store in $2).
Skip double-quote, then anything then the text 'Age:' then spaces,
then grab digits (store in $3), and we're done.

Is that close?!


------------------------------

Date: Mon, 18 Feb 2008 12:56:25 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Parsing multi-line text
Message-Id: <61t9vlF20cdi5U1@mid.individual.net>

keith@bytebrothers.co.uk wrote:
> On 18 Feb, 11:18, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> 
>>      local $/ = 'Chunk';
>>      while (<>) {
>>          if ( /(¥d+).+[A-Z]+:¥s+"([^"]*)".+Age:¥s+(¥d+)/s ) {
>>              printf "%02d NAME: %-10s -> %d¥n", $1, $2, $3;
>>          }
>>      }
> 
> Gotta love this place - thanks!
> 
> Now, let's see if I can decipher (no point in asking if I don't learn
> from the answer)...
> 
> You make the text 'Chunk' the record delimiter.  Then inside each
> record you look for digits (store in $1). Skip anything followed by
> uppercase text followed by colon followed by space followed by double-
> quote.  Now grab everything up to next double quote (store in $2).
> Skip double-quote, then anything then the text 'Age:' then spaces,
> then grab digits (store in $3), and we're done.
> 
> Is that close?!

Yep, that's about it.

Since each chunk spans over multiple lines, the /s modifier is important 
(makes . match also newlines).

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Mon, 18 Feb 2008 06:34:21 -0800 (PST)
From: RK_78 <riad.kaced@gmail.com>
Subject: Re: Regular Expression to Replace UPPER Case Text with lower case  text
Message-Id: <2cf3a881-c046-4a15-9c55-38d284527f68@i7g2000prf.googlegroups.com>

On Feb 18, 2:42 am, penny <kevin.pe...@gmail.com> wrote:
> Is there a way in Regular Expressions to convert a string that is all
> in upper case - and replace it with it's lower case equivalent?
>
> I can do something like ([A-Z][A-Z]+¥x?) to match any given word and
> reference it as ¥1, however without using programming language lcase
> or LOWER functions on it - how can I use reg ex to convert the text to
> it's lower case equivalent??
>
> Thanks - (I use coldfusion but the regular expression syntax is
> similar)

Hi Penny ;

Try This

my $InFile=$ARGV[0] || die("**ERROR** -> Usage: $0 InputFile
OutputFile ¥n");
my $OutFile=$ARGV[1] || die("**ERROR** -> Usage: $0 InputFile
OutputFile ¥n");

open(INFILE,"< $InFile") || die "cannot open $InFile : $!";  # $!
Stores the error message
open(OUTFILE,"> $OutFile") || die "cannot open $OutFile : $!";

my $line;

while ($line=<INFILE>) {
	$line =‾ tr/A-Z/a-z/;
	printf(OUTFILE $line);
}

close(INFILE);
close(OUTFILE);



The key point here is the tr/// transliteration operator.

Better ideas folks ?

Riad.


------------------------------

Date: Mon, 18 Feb 2008 07:49:36 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Regular Expression to Replace UPPER Case Text with lower case  text
Message-Id: <3e80ed2e-91da-4b65-9e28-5ceaf60a9eb2@s37g2000prg.googlegroups.com>

On Feb 18, 9:34 am, RK_78 <riad.ka...@gmail.com> wrote:
> Better ideas folks ?

Ditch CF and use Perl.

;-)

CC


------------------------------

Date: 18 Feb 2008 11:44:04 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Regular Expression to Replace UPPER Case Text with lower case text
Message-Id: <87skzq43l7.fsf@mithril.chromatico.net>

>>>>> "p" == penny  <kevin.penny@gmail.com> writes:

    p> Is there a way in Regular Expressions to convert a string that
    p> is all in upper case - and replace it with it's lower case
    p> equivalent?

There's a very simple way in Perl, but it doesn't use a regular expression.

    p> Thanks - (I use coldfusion but the regular expression syntax is
    p> similar)

Then why aren't you asking in a ColdFusion newsgroup?

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


------------------------------

Date: Mon, 18 Feb 2008 03:34:35 -0800 (PST)
From: cokofreedom@gmail.com
Subject: Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz  (sanitizer)
Message-Id: <b81378b9-7e10-4c5b-8b2f-4270053b91d3@n77g2000hse.googlegroups.com>

Dear Ilias,

Post in a single reply.

Coko


------------------------------

Date: Mon, 18 Feb 2008 12:17:25 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: unicode <-> hex
Message-Id: <87tzk6fr96.fsf@zeekat.nl>

nazrat <newtan@gmail.com> writes:

> i'd like to know if there's a way to get back the original hex values
> of a unicode character.
> ex:
> my $u = "¥x{20A3}";
> my $h = pack(....., $u) ?  so that $h is now a string '20A3'.  thanks.

my $h = sprintf("%X",ord($u));

There's probably some way to do this using (un)pack, but I doubt it's much
more efficient if you're going at it char-by-char.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1286
***************************************


home help back first fref pref prev next nref lref last post