Re: Using regular expressions to populate a variable?

2015-01-18 Thread Charles DeRykus
On Sun, Jan 18, 2015 at 9:28 AM, Jim Gibson wrote: > >> On Jan 18, 2015, at 9:03 AM, Mike wrote: >> >> I was able to find match extraction in the perldoc. >> >> Here is a snippet of what I have. >> >> my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ ); >> print "$insult\n"; >> >> But $insul

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Mike
Thanks. This worked. On 1/18/15 12:28 PM, Jim Gibson wrote: On Jan 18, 2015, at 9:03 AM, Mike wrote: I was able to find match extraction in the perldoc. Here is a snippet of what I have. my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ ); print "$insult\n"; But $insult is being popula

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Jim Gibson
> On Jan 18, 2015, at 9:03 AM, Mike wrote: > > I was able to find match extraction in the perldoc. > > Here is a snippet of what I have. > > my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ ); > print "$insult\n"; > > But $insult is being populated with: 1 > > It should be populated wi

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Mike
I was able to find match extraction in the perldoc. Here is a snippet of what I have. my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ ); print "$insult\n"; But $insult is being populated with: 1 It should be populated with text. Can anyone tell me what I'm doing wrong here? Thanks.

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 11:49:11 -0500 Mike wrote: > Hey everyone, I'm trying to find information on how I can use regular > expressions to populate a variable. > > I want to pull text between one set of characters and another set of > characters and use that to populate my variable. Can anyone po

Using regular expressions to populate a variable?

2015-01-18 Thread Mike
Hey everyone, I'm trying to find information on how I can use regular expressions to populate a variable. I want to pull text between one set of characters and another set of characters and use that to populate my variable. Can anyone point me in the right direction? Thanks. -- To unsubscri

Re: Using regular expressions with delimitaters

2007-04-12 Thread yaron
sday, April 11, 2007 4:30:58 PM (GMT+0200) Auto-Detected Subject: Using regular expressions with delimitaters Hello, I need to use the delimiter " " , (one blank space). I read perdoc, i try to use this : if ( "8.1.8" =~ /[\d $versao \s]/) But the expression is always true. Wh

Re: Using regular expressions with delimitaters

2007-04-11 Thread Chas Owens
On 4/11/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: snip if ( "8.1.8" =~ /$version/) snip You are using the operators incorrectly. It should look like this: if ($version =~ /8\.1\.8/) The form is "variable binding_operator regex". Note that the periods need to be escaped otherwise they w

RE: Using regular expressions with delimitaters

2007-04-11 Thread Moon, John
From: Rodrigo Tavares [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 9:31 AM To: beginners@perl.org Subject: Using regular expressions with delimitaters Hello, I need to use the delimiter " " , (one blank space). I read perdoc, i try to use this : if ( "8.1.8"

Using regular expressions with delimitaters

2007-04-11 Thread Rodrigo Tavares
Hello, I need to use the delimiter " " , (one blank space). I read perdoc, i try to use this : if ( "8.1.8" =~ /[\d $versao \s]/) But the expression is always true. Where is the error ? my code : #!/usr/bin/perl $version=`/usr/local/pgsql/bin/pg_ctl --version`; print $version; if ( "8.1.8" =

Re: problem using regular expressions

2005-05-03 Thread Offer Kaye
On 5/3/05, Ing. Branislav Gerzo wrote: > > CD>my $address = '[EMAIL PROTECTED]'; > CD>my ( $domain = $address ) =~ m/@(.*)/; > > uff, I think you write this in hurry, this simply won't work. For completeness, you really should write what *will* work. Here's a correct version: my $add

Re: problem using regular expressions

2005-05-03 Thread Ing. Branislav Gerzo
Chris Devers [CD], on Tuesday, May 3, 2005 at 10:58 (-0400 (EDT)) thoughtfully wrote the following: >> I use BayesIt in The Bat, works well. CD> Is it written in Perl ? I don't think so :) CD> Part of the reason I suggested SpamAssassin -- aside from it being an CD> effective tool in its own rig

Re: problem using regular expressions

2005-05-03 Thread Chris Devers
On Tue, 3 May 2005, Ing. Branislav Gerzo wrote: > Chris Devers [CD], on Tuesday, May 3, 2005 at 10:16 (-0400 (EDT)) > typed: > > CD>my $address = '[EMAIL PROTECTED]'; > CD>my ( $domain = $address ) =~ m/@(.*)/; > > uff, I think you write this in hurry, this simply won't work. Sorry, ye

Re: problem using regular expressions

2005-05-03 Thread Ing. Branislav Gerzo
Chris Devers [CD], on Tuesday, May 3, 2005 at 10:16 (-0400 (EDT)) typed: CD>my $address = '[EMAIL PROTECTED]'; CD>my ( $domain = $address ) =~ m/@(.*)/; uff, I think you write this in hurry, this simply won't work. You have already declared $address so it will make exception, and also wi

Re: problem using regular expressions

2005-05-03 Thread Chris Devers
On Tue, 3 May 2005, gavin mc auley wrote: > I am new to perl and regular expressions. I am trying to write a > simple spam filter. There's your first mistake! :-) This is a slippery slope. Your simple filter isn't going to be as effective as you want, so you'll want to tweak it. The second d

Re: problem using regular expressions

2005-05-03 Thread Ing. Branislav Gerzo
gavin mc auley [gma], on Tuesday, May 03, 2005 at 15:03 (+0100) has on mind: gma> is [EMAIL PROTECTED], I want to extract hotmail.com. This is here is 2 ways how to do that: (my $domain = '[EMAIL PROTECTED]') =~ s/[EMAIL PROTECTED]@//; or my $domain = $1 if '[EMAIL PROTECTED]' =~ /@(.*)/; there

problem using regular expressions

2005-05-03 Thread gavin mc auley
I am new to perl and regular expressions. I am trying to write a simple spam filter. for part of this program I want to extract all characters after the @ character. i.e. if the email is [EMAIL PROTECTED], I want to extract hotmail.com. This is probably a simple task but I am having a problem ac

Re: Spam:Re: Using regular expressions

2004-11-24 Thread John W. Krahn
[ Please do not top-post. TIA ] [ Please trim your posts. ( excess message trimmed ) TIA ] Michael Kraus wrote: John, Lighten up matey... The examples I've given are just that examples... Error checking functionality is up the end programmer... (And you are quite right, you should check the statu

RE: Spam:RE: Spam:Re: Using regular expressions

2004-11-24 Thread Michael Kraus
> -Original Message- > From: Michael Kraus [mailto:[EMAIL PROTECTED] > Sent: Thursday, 25 November 2004 11:27 AM > To: John W. Krahn; Perl Beginners > Subject: Spam:RE: Spam:Re: Using regular expressions > > John, > > Lighten up matey... > > The exampl

Re: Using regular expressions

2004-11-24 Thread Gunnar Hjalmarsson
[ Please do not quote the whole message you are responding to, but only what's needed to give context. Also, please type your reply *below* the part(s) of the message you are commenting on. ] Michael Kraus wrote: John W. Krahn wrote: You should *always* verify that the files were opened correctl

RE: Spam:Re: Using regular expressions

2004-11-24 Thread Michael Kraus
November 2004 11:17 AM > To: Perl Beginners > Subject: Spam:Re: Using regular expressions > > Michael S. E. Kraus wrote: > > G'day... > > Hello, > > > On Wed, 2004-11-24 at 23:10, FlashMX wrote: > > > >>To be able to do a grep on a file via a

Re: Using regular expressions

2004-11-24 Thread John W. Krahn
Michael S. E. Kraus wrote: G'day... Hello, On Wed, 2004-11-24 at 23:10, FlashMX wrote: To be able to do a grep on a file via a perl script do you have to read the whole file in before performing the search and replace? I've been hearing that reading the whole file in takes up memory and if multipl

Re: Using regular expressions

2004-11-24 Thread John W. Krahn
Michael S. E. Kraus wrote: G'day... Hello, On Wed, 2004-11-24 at 23:00, FlashMX wrote: Could you give an example of using grep on a array to do a replace? grep example: if (grep(/bazza/i, @myarray)) { print "Bazza's home!\n"; } OR my @bazza_list = grep {/bazza/i} @myarray; (Either form is

Re: Using regular expressions

2004-11-24 Thread Michael S. E. Kraus
G'day... On Wed, 2004-11-24 at 23:00, FlashMX wrote: > Could you give an example of using grep on a array to do a replace? grep example: if (grep(/bazza/i, @myarray)) { print "Bazza's home!\n"; } OR my @bazza_list = grep {/bazza/i} @myarray; (Either form is fine) However to do a repl

Re: Using regular expressions

2004-11-24 Thread Michael S. E. Kraus
G'day... On Wed, 2004-11-24 at 23:10, FlashMX wrote: > To be able to do a grep on a file via a perl script do you have to read the > whole file in before performing the search and replace? I've been hearing > that reading the whole file in takes up > memory and if multiple users are running the

Re: Using regular expressions

2004-11-24 Thread FlashMX
To be able to do a grep on a file via a perl script do you have to read the whole file in before performing the search and replace? I've been hearing that reading the whole file in takes up memory and if multiple users are running the script then you better have alot of swap and memory. Is thi

Re: Using regular expressions

2004-11-24 Thread FlashMX
Could you give an example of using grep on a array to do a replace? On Wed, 24 Nov 2004 10:05:39 +0530, Prasanna Kothari wrote: >Hi, >Replace >$output = ~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; >with >my $output =~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; > >You can use "perl -c " which will show you such ty

Re: Using regular expressions

2004-11-23 Thread Prasanna Kothari
Hi, Replace $output = ~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; with my $output =~ s/AAA*?BBBt/AAA 111 *?222 BBB/g; You can use "perl -c " which will show you such type of errors. After opening the output file, it's better to check if the file is opened successfully(as done in the case of INPUT). I thin

re: Using regular expressions

2004-11-23 Thread FlashMX
Hi, The code below opens a file and writes the contents to a temporary file. I need to do a search and replace of certain matches in the files and I thought I might be able to use regular expressions. Being new to perl and now trying expressions has almost put me over the edge. When I run the

Re: using regular expressions to find sequences of items in data

2002-01-06 Thread John W. Krahn
"John W. Krahn" wrote: > > Jon Hans wrote: > > > > #ugly > >if ( defined $frequency{$datalist[$first]} && > > defined $frequency{$datalist[$first+1]} && > > $frequency{$datalist[$first+2]} && > > $frequency{$datalist[$first+3]} && > > $frequency{$datalist[$first+4]} && > > $frequency{$datalis

Re: using regular expressions to find sequences of items in data

2002-01-06 Thread John W. Krahn
Jon Hans wrote: > > #!/usr/bin/perl > ### > > I am trying to find all of the reoccurring sequences > excluding the sub sequences. > > Maybe I am missing the obvious, but having a little > perl exposure and not being an expert perl programmer >

using regular expressions to find sequences of items in data

2002-01-06 Thread jon hans
#!/usr/bin/perl ### I am trying to find all of the reoccurring sequences excluding the sub sequences. Maybe I am missing the obvious, but having a little perl exposure and not being an expert perl programmer I have hacked together some code tha