On 2012-12-28 21:32, twle...@reagan.com wrote:
I hope this is a simple fix. I want to check the beginning characters of items in a
hash, and compare that to a scalar variable. I do not need for the entire value to
match; just the first couple of characters. Here is a simple example of what
Hi,
my $prefix_search_list = '03S,04S';
my @prefix_array = split /\,/,$prefix_search_list;
my %prefix_hash = map {$_ = 1 } @prefix_array;
#compare 05S to 03S and 04S
my $input_field = 05S885858; #should not match
1. using stricts and warnings pragma, shows clearly that there is nothing
Tim wrote in message news:1356726727.215915...@webmail.reagan.com...
I hope this is a simple fix. I want to check the beginning characters of
items in a hash, and compare that to a scalar variable.
I do not need for the entire value to match; just the first couple of
characters.
Tim
my
Hello Chris,
Please see my comment below.
On Fri, Dec 28, 2012 at 10:24 PM, Chris Charley char...@pulsenet.comwrote:
Tim wrote in message news:1356726727.215915216@**webmail.reagan.com...
I hope this is a simple fix. I want to check the beginning characters of
items in a hash, and
Chris Charley wrote in message news
Tim wrote in message news:1356726727.215915...@webmail.reagan.com...
I hope this is a simple fix. I want to check the beginning characters of
items in a hash, and compare that to a scalar variable.
I do not need for the entire value to match; just the
@perl.org
Subject: Re: Pattern matching to hash
Hi,
my $prefix_search_list = '03S,04S';
my @prefix_array = split /\,/,$prefix_search_list;
my %prefix_hash = map {$_ = 1 } @prefix_array;
#compare 05S to 03S and 04S
my $input_field = 05S885858; #should not match
1. using stricts
Thank you Chris. Using strict and warnings should have been the first thing
that I did. Thank you also for the code correction.
-Original Message-
From: Chris Charley [mailto:char...@pulsenet.com]
Sent: Friday, December 28, 2012 5:52 PM
To: beginners@perl.org
Subject: Re: Pattern
timothy adigun wrote in message
news:CAEWzkh6mZohVJn__LRL60AGoqbHkmTPyn=JM=cewcmmftpj...@mail.gmail.com...
Hello Chris,
Please see my comment below.
On Fri, Dec 28, 2012 at 10:24 PM, Chris Charley
char...@pulsenet.comwrote:
[snip]
I only answered the question using a for loop. Am
On 11-09-27 05:30 PM, Chris Stinemetz wrote:
Trying to match the what is contained in $what 3 consecutive times.
But I am getting the followoing error:
Use of uninitialized value $_ in pattern match (m//) at ./ex9-1.pl line 7.
The program:
#!/usr/bin/perl
use warnings;
use strict;
my $what
On Mon, 12 Apr 2010 23:04:53 -0500, Owen Chavez wrote:
Can you suggest a reference on hashes that will provide some clue as to
how they can be used for the problem I posted? I've looked over
Programming Perl (3rd) and it's not entirely clear to me how to proceed
with a hash.
Learning Perl
Owen Chavez wrote:
Hello!
I have a pattern matching question using Perl 5.10, Windows 7. Suppose I
have a file containing the following block of text:
Hello there TODD
I my We Us ourselves OUr I.
The file has 10 words, including 7 first-person pronouns (and 3 non-pronouns
that I have no
On Mon, 12 Apr 2010 21:06:58 -0500, Owen Chavez wrote:
I have a pattern matching question using Perl 5.10, Windows 7. Suppose
I have a file containing the following block of text:
Hello there TODD
I my We Us ourselves OUr I.
The file has 10 words, including 7 first-person pronouns (and 3
Thank you for the feedback. I do apologize for not posting a working
example; I can't post the full code and I was attempting to extract the
offending sections.
I have no particular fondness for grep. A search of postings on perlmonks
revealed a variation of the code I employed. I am learning
On Tue Mar 31 2009 @ 3:32, Richard Hobson wrote:
It works, but is there a way of combining these lines:
my $piece = $ref-[$_];
$piece =~ /.*(..$)/;
It feels like this could be done in one step. Is this correct? I'm
finding that I'm doing
Richard Hobson wrote:
Hi,
Hello,
Please be patient with this beginner. I have a subrouting as follows,
that prints out an ASCII representation of chess board
sub display_board {
foreach (0..7) {
my $ref = @_[$_];
That should be:
my $ref = $_[$_];
Or better:
Hi Anjan,
Not able to get what your column is. I am Assuming your column is
in Text file. However even if it is not in text file, then this may provide
you a fair hint about how to proceed further.
use warnings;
use strict;
open FH,example.txt or die Cannot open file: $!; #(example.txt
On Mon, 2008-09-22 at 21:21 -0400, ANJAN PURKAYASTHA wrote:
here is my problem:
i have to check the entries of a column and write them out to a file if they
happen to be DNA sequences ie they are exclusively composed of the letters
A, T, G, C- no spaces or digits.
the column also happens to
Hi Anjan,
Not able to get where your column is. I am Assuming your column is
in Text file. However even if it is not in text file, then also this may
provide you a fair hint about how to proceed further.
use warnings;
use strict;
open FH,example.txt or die Cannot open file: $!;
hi all,
the column is in a text file. fyi, david's pattern matching expression
(/^[ATGC]+$/i) did the job perfectly.
thanks all for you feedback!
anjan
On Tue, Sep 23, 2008 at 5:07 AM, sanket vaidya [EMAIL PROTECTED]wrote:
Hi Anjan,
Not able to get where your column is. I am Assuming
On Tue, 2008-09-23 at 14:05 -0700, Darren Nay wrote:
Here is the string:
xsl:output method=html encoding=utf-8 indent=yes
doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN /
Now, I want to match against that string
-Original Message-
From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 23 September 2008 11:22 AM
To: beginners@perl.org
Subject: pattern matching question
here is my problem:
i have to check the entries of a column and write them out to a file if they
happen to be DNA
Anirban Adhikary wrote:
Subject: Pattern matching problem
As far as I can tell, this is not a pattern matching problem.
I have a very large file basically it is logfile generated by sql
loader. In the production environment this file can have one
million/ two million data. In this
Dharshana Eswaran schreef:
TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID
TAPI_TTY_NOTIFY_TTY_TONE_MSGID
[...]
Can anyone help me in getting a generalised pattern from these?
m/^ TAPI (?:_[A-Z]+)+ $/x
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
On 2/21/07, Dr.Ruud [EMAIL PROTECTED] wrote:
Dharshana Eswaran schreef:
TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID
TAPI_TTY_NOTIFY_TTY_TONE_MSGID
[...]
Can anyone help me in getting a generalised pattern from these?
m/^ TAPI (?:_[A-Z]+)+ $/x
--
Affijn, Ruud
Gewoon is een tijger.
--
To
On 2/21/07, Dharshana Eswaran [EMAIL PROTECTED] wrote:
On 2/21/07, Dr.Ruud [EMAIL PROTECTED] wrote:
Dharshana Eswaran schreef:
TAPI_VOICE_NOTIFY_OTHERAPP_JOINING_MSGID
TAPI_TTY_NOTIFY_TTY_TONE_MSGID
[...]
Can anyone help me in getting a generalised pattern from these?
m/^ TAPI
Dharshana Eswaran schreef:
m/^ #TAPI (?:_[A-Z]+)+ $/x
But this is filtering both the strings starting from TAPI and the
strings starting from #TAPI.
Yes, # starts a comment, so makes the regex equivalent to m/^/, which
will allways match.
echo 'abc' |
perl -nle '
/^ # test/x and
On 1/19/07, Igor Sutton [EMAIL PROTECTED] wrote:
I have an update:
my @data = $string =~ m/0x(\d{2})/g;
my @data = $string =~ m/0x(\S{2}),?/g;
Now I think it is right :)
--
Igor Sutton Lopes [EMAIL PROTECTED]
I used the above expression and it worked for me. Thanks you so much.
Thanks
On 1/19/07, Rob Dixon [EMAIL PROTECTED] wrote:
Igor Sutton wrote:
I have an update:
my @data = $string =~ m/0x(\d{2})/g;
my @data = $string =~ m/0x(\S{2}),?/g;
Now I think it is right :)
my @data = $string =~ m/=0x(..)/g;
:)
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
On 1/19/07, John W. Krahn [EMAIL PROTECTED] wrote:
Dharshana Eswaran wrote:
Hi All,
Hello,
I have a string as shown below:
$string =
{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}
This is stored as a string in
Hi Dharshana,
2007/1/19, Dharshana Eswaran [EMAIL PROTECTED]:
Hi All,
I have a string as shown below:
$string =
{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}
This is stored as a string in a variable. I need to pull
I have an update:
my @data = $string =~ m/0x(\d{2})/g;
my @data = $string =~ m/0x(\S{2}),?/g;
Now I think it is right :)
--
Igor Sutton Lopes [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Igor Sutton wrote:
I have an update:
my @data = $string =~ m/0x(\d{2})/g;
my @data = $string =~ m/0x(\S{2}),?/g;
Now I think it is right :)
my @data = $string =~ m/=0x(..)/g;
:)
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Dharshana Eswaran wrote:
Hi All,
Hello,
I have a string as shown below:
$string =
{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}
This is stored as a string in a variable. I need to pull out only the
numbers
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to
identify this pattern in messages. [URL
Here is what I have:
if ($FORM{'message} =~ /\[URL/ig) {
#do something;
}
Where
[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to identify
this pattern in messages. [URL
Here is what I have:
if ($FORM{'message} =~ /\[URL/ig) {
#do something;
}
Where $FORM('message') is a messaage that includes many
In a message dated 7/23/2006 9:39:34 A.M. Pacific Standard Time,
[EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to
identify
this pattern in messages. [URL
Here is what I have:
if
Ryan Dillinger wrote:
Hello All,
I was studying some pattern matching. And I ran into this piece of code.
Now I believe I understand it up until the the last part \1.
Can someone explain it for me please?
Match lowercase a through z, uppercase A through lc z
no more than three times, with white
Timothy Johnson schreef:
You should south-post. You should trim.
\1 is the same thing as $1 inside of a regex, but it is generally
recommended that you don't use it.
That is a misinterpretation. It is OK (and efficient) to use the
backreferences \1, \2, \3 etc. in a regex.
The \1 (as a
\1 is the same thing as $1 inside of a regex, but it is generally
recommended that you don't use it.
From 'perldoc perlre':
Warning on \1 vs $1
Some people get too used to writing things like:
$pattern =~ s/(\W)/\\\1/g;
This is grandfathered for the RHS of a substitute to
On 7/17/06, Ryan Dillinger [EMAIL PROTECTED] wrote:
Now I believe I understand it up until the the last part \1.
/([a-zA-z]{3})\s*\1/
That's a backreference; it matches if the corresponding part of the
string is equal to what's in memory one at the time of the match.
Memory one holds the
On Monday 17 July 2006 18:20, Timothy Johnson wrote:
\1 is the same thing as $1 inside of a regex, but it is generally
recommended that you don't use it.
I thought it's ok to use it in a match or on the *left* side (but not on the
right side) of a substitution
then I'm stumped, what's the 1
Ryan Dillinger wrote:
Hello All,
Hello,
I was studying some pattern matching. And I ran into this piece of code.
Now I believe I understand it up until the the last part \1.
Can someone explain it for me please?
Match lowercase a through z, uppercase A through lc z
That must be a mistake
Dr. Claus-Peter Becke wrote:
foreach (/(\w+)/i) {
push @words,$;
}
print$q-popup_menu('to_thesaurus', @words);
this solution succeeds in finding and returning the last element...
There are a few problems here:
1. regex should use the /g modifier to find all matches in the string
Dr. Claus-Peter Becke wrote:
[...]
foreach (/(\w+)/i) {
push @words,$;
}
print$q-popup_menu('to_thesaurus', @words);
[...]
Use the /g (global) option to the match operator, and push $_ onto
@words rather than $:
foreach (/(\w+)/ig) {
push @words, $_;
}
Or ditch the 'foreach'
Dr. Claus-Peter Becke wrote:
dear mumia w.,
thank you for your support. i have chosen the simplest solution you
recommanded. i still have one problem. i would like to print every word
in a new line.
push @woerter,/[a-zäöüß]/ig;
print$q-li(@woerter);
it's unfortunaltely impossible to
Hi,
Sorry, it was working, found out the problem was due
to something else.
Thanks,
Anu.
--- anu p [EMAIL PROTECTED] wrote:
Hi,
I have the following code snippet in which I open
two
files for read.
For each line in file 1 (log.txt), I extract the
test
name, which is of format
Dax Mickelson schreef:
I am having problems matching ALL possible matches of a string against
another (very large) string. I am doing something like: @LargeArray
= ($HugeString =~ m/$Head/ig); Where $Head is an 8 character
string. (Basically I want to get all 16 character long
Dr.Ruud:
#!/usr/bin/perl
use strict; use warnings;
{ local ($,, $\) = (':', \n);
$_ = 'AASDFGHJKL';
my $Head = '';
print $Head, $1, substr($',0,7) while /(?=$Head)(.)(?=.{7})/ig;
}
Revision:
#!/usr/bin/perl
use strict; use warnings;
my
On Nov 27, Dax Mickelson said:
I am having problems matching ALL possible matches of a string against
another (very large) string. I am doing something like: @LargeArray =
($HugeString =~ m/$Head/ig); Where $Head is an 8 character
string. (Basically I want to get all 16 character
Hope you are getting what you require..
If not, what you expect the result to be?
With Best Regards,
Karthikeyan S
Honeywell Process Solutions - eRetail
Honeywell Automation India Limited
Phone:91-20-56039400 Extn -2701
Mobile :(0)9325118422
E-Mail: [EMAIL PROTECTED]
This e-mail, and any
Dax Mickelson wrote:
I am having problems matching ALL possible matches of a string against
another (very large) string. I am doing something like: @LargeArray =
($HugeString =~ m/$Head/ig); Where $Head is an 8 character
string. (Basically I want to get all 16 character long
Hi ,
in $prog =~ s/^.*\///;
is it trying to substitute all characters until the
last / within $prog?
meena
--- MEENA SELVAM [EMAIL PROTECTED] wrote:
Hi,
can anyone please explain?
In the following code snippet, what is the meaning
of
the pattern match
s/^.*\///
$prog = $0;
$prog
On Sun, 19 Jun 2005, MEENA SELVAM wrote:
can anyone please explain?
See `perldoc perlre`, or `man perlre`, or a book like _Learning Perl_ or
_Mastering Regular Expressions_ for this kind of thing.
It's really an introductory question that any decent introductory text
should be able to cover
Hi Chris,
Thanks for your detailed email and for your time. I
think my second email crossed your email. The book I
read on Perl did not mention anything about first and
second half, and that didnt explain, me that we were
replacing all upsto last / by nothing. I thought it is
replacing with /
Am Dienstag, 10. Mai 2005 11.01 schrieb Tielman Koekemoer (TNE):
Hi all,
I have tried various regular expressions to remove null or empty
values on array @array1 and create a new array @OPD01 with the values.
This, however, does not work as I still get a number of empty values
in the @OPD01
Tielman Koekemoer (TNE) [TK], on Tuesday, May 10, 2005 at 11:01
(+0200) contributed this to our collective wisdom:
TK I have tried various regular expressions to remove null or empty
TK values on array @array1 and create a new array @OPD01 with the values.
TK This, however, does not work as I
Hi John,
Try to use 'chop' to get null value
Thanks and Regards
Pramod
John Doe wrote:
Am Dienstag, 10. Mai 2005 11.01 schrieb Tielman Koekemoer (TNE):
Hi all,
I have tried various regular expressions to remove null or empty
values on array @array1 and create a new array @OPD01 with the values.
$counter2 = 0;
What's that for? (never used)
Hmm yeah sorry that was supposed to be $counter = 0;
Use push() to avoid holding the current array index.
What do you mean by holding the index?
my @array1=(' ', 'a', '', 'b', \0, 'c', undef, 'd', ' ', 'e'); my
@new=grep {$_ and !/^\s+$/ and
Ah I see: use push() to add scalars/lists to arrays.
Thanks everyone for the help.
Use push() to avoid holding the current array index.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
Am Dienstag, 10. Mai 2005 11.46 schrieb Tielman Koekemoer (TNE):
$counter2 = 0;
What's that for? (never used)
Hmm yeah sorry that was supposed to be $counter = 0;
Use push() to avoid holding the current array index.
What do you mean by holding the index?
remember (and incrementing) the
Am Dienstag, 10. Mai 2005 11.23 schrieb Kpramod:
Hi John,
Try to use 'chop' to get null value
Thanks and Regards
Pramod
Hi Pramad,
sorry, I don't understand what you mean. Do you refer to the line
my @new=grep {$_ and !/^\s+$/ and !/^\0+$/} @array1;
(I see that the test for \0 is ugly,
Chris Schults wrote:
I'm sending this on behalf of our intern Elmer. Thanks in advance for any
assistance. Chris
Hi there!
If anyone out there is good with Perl's pattern matching, maybe you can help
me out. I am trying to take a string and derive information from it that is
separated by commas
Aaron Reist wrote:
From: John W. Krahn [EMAIL PROTECTED]
Aaron Reist wrote:
From: John W. Krahn [EMAIL PROTECTED]
You could use a regular expression to do that.
my $input = get_input_from_user();
$input =~
/\A(?:[[:alpha:]]([[:alnum:]]{9})[[:alpha:]]|(\d[[:alnum:]]{7}\d))\z/
and my
Aaron Reist wrote:
From: John W. Krahn [EMAIL PROTECTED]
Aaron Reist wrote:
Currently I have a simple program takes a username from a html
textbox and checks against a list of values in a notepad document.
If the name is found the user is given access, if not they are
prompted to try again.
Aaron Reist wrote:
Hello everyone,
Hello,
not quite sure if what I m trying to do is possible, but here is the
basic idea:
Currently I have a simple program takes a username from a html textbox
and checks against a list of values in a notepad document. If the name
is found the user is given
Aaron Reist [AR], on Friday, February 25, 2005 at 01:58 (-0500) typed
the following:
AR The program will check for two types of usernames - the first is #xxx#
AR (9 alphanumeric characters. beginning and ending with a number)the
AR second is XxX (11 alphanumeric charactors, the
Dan Fish wrote:
Are ALL pattern matching variables set back to undef once another m// or
s/// expression is encountered, even if it contains no parenthized
expressions?
perldoc perlre
[snip]
The numbered match variables ($1, $2, $3, etc.) and the related
punctuation set ($+, $, $`,
On Wed, 12 Jan 2005 17:27:46 -0700, Dan Fish [EMAIL PROTECTED] wrote:
Are ALL pattern matching variables set back to undef once another m// or
s/// expression is encountered, even if it contains no parenthized
expressions?
For example, I would have expected $1 $2 to be valid in BOTH print
i'm trying to figure out how to split a file delimited
by commas and newlines.
Sounds like a CSV file to me, and for those you look on
CPAN for a ready made solution.
http://search.cpan.org/search?query=CSVmode=module
Jonathan Paton
--
#!perl
$J=' 'x25 ;for (qq 1+10 9+14 5-10 50-9 7+13 2-18
- Original Message -
From: John McCormick
i'm trying to figure out how to split a file delimited
by commas and newlines.
@data = split (/\n|\,/, infile)
the only problem is that some of the data fields are
strings enclosed in double quotes, and within some of
those double quotes are
On Thu, 23 Dec 2004, John McCormick wrote:
i'm trying to figure out how to split a file delimited
by commas and newlines.
@data = split (/\n|\,/, infile)
the only problem is that some of the data fields are
strings enclosed in double quotes, and within some of
those double quotes are more
On Sunday, Oct 31, 2004, at 21:11 US/Central, John W. Krahn wrote:
Robert Citek wrote:
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1string2
where the strings 1 2 can contain alphabets,numbers and
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1string2
where the strings 1 2 can contain alphabets,numbers and spaces. The
string are separated by '' sign. I wrote the following code for this.
I used this solution
if(/([a-z0-9\t ]*)([a-z0-9\t ]*)/gi) {
$string1 = $1;
$string2 = $2;
}
Quoting Robert Citek [EMAIL PROTECTED]:
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
[EMAIL PROTECTED] wrote:
I used this solution
if(/([a-z0-9\t ]*)([a-z0-9\t ]*)/gi) {
$string1 = $1;
$string2 = $2;
}
That was the one I suggested. It may or may not be a decent solution for
what you are doing; I for one can't tell without knowing more.
One detail: The /g modifier is
The original regex matched on
lower case
then
uper case
then
digits
then
white space
then
the separator
then
lower case
then
uper case
then
digits
then
white space
This is not what you wanted.
If '' is the separator then you should match on:
anything other than the separator
Robert Citek wrote:
On Saturday, Oct 30, 2004, at 20:52 US/Central, John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1string2
where the strings 1 2 can contain alphabets,numbers and spaces. The
string are separated by '' sign. I wrote the following code
[EMAIL PROTECTED] wrote:
I have to match patterns of the format
string1string2
where the strings 1 2 can contain alphabets,numbers and spaces. The
string are separated by '' sign. I wrote the following code for this.
if(/([a-z]*[A-Z]*[0-9]*[\s]*)([a-z]*[A-Z]*[\s]*[0-9]*)/g) {
$string1 = $1;
[EMAIL PROTECTED] wrote:
Hi All,
Hello,
I have to match patterns of the format
string1string2
where the strings 1 2 can contain alphabets,numbers and spaces. The
string are separated by '' sign. I wrote the following code for this.
if(/([a-z]*[A-Z]*[0-9]*[\s]*)([a-z]*[A-Z]*[\s]*[0-9]*)/g) {
Thanks James. I am going to try this method also. Your input is very much appreciated.
JC
James Edward Gray II [EMAIL PROTECTED] wrote:
On Jul 16, 2004, at 3:46 PM, jason corbett wrote:
I want to eliminate the . (periord) or , (comma) from records
that I return from a query, but I cannot
Jason,
I want to eliminate the . (periord) or , (comma) from records that I
return from a query, but I cannot figure out how to approach it. Does Perl
have a way that I can match a string that from an array, remove a character or
characters?
Yes. You could use a regular expression s/\.//
On Jul 16, 2004, at 3:46 PM, jason corbett wrote:
I want to eliminate the . (periord) or , (comma) from records
that I return from a query, but I cannot figure out how to approach
it. Does Perl have a way that I can match a string that from an array,
remove a character or characters?
For
jason corbett [EMAIL PROTECTED] wrote:
: I want to eliminate the . (periord) or , (comma) from
: records that I return from a query, but I cannot figure out
: how to approach it. Does Perl have a way that I can match a
: string that from an array, remove a character or characters?
:
:
: For
Thanks to all that helped with this problem, and thanks especially to
RandyS as he hit the nail on the head. Here is the final working code
block below.
while (LOGFILE) {
chop $_ ;
if( (/JUNIPER/) || (/REDBACK/) ){
print DSL $_ . \n;
} else {
Christopher L Hood wrote:
I have a log file with thousands of lines, some of those lines come
in with garbage / binary data in them. The lines with that
happening are junk and of no use to me I want to pattern match for
the junk and simply do nothing with that line, all other lines get
divided
On 6/30/2004 5:20 PM, [EMAIL PROTECTED] wrote:
I have a log file with thousands of lines, some of those lines come in with garbage / binary data in them. The lines with that happening are junk and of no use to me I want to pattern match for the junk and simply do nothing with that line, all other
On Wednesday 30 June 2004 15:07, Randy W. Sims wrote:
try either:
/[:print:]/ print junk;
So you are saying that the characters ':', 'p', 'r', 'i', 'n' and 't'
are junk? You probably meant to use the character class [^[:print:]]
or [[:^print:]] instead. :-)
John
--
use Perl;
program
On Jun 23, 2004, at 12:34 PM, [EMAIL PROTECTED] wrote:
Hi,
I have a string similar to:
Comment: FILING
---
-
This is read in as one line (with the page feed).
I was trying to whatever follows the words and I tried
(Let's keep our discussion on the list for all to see.)
On Jun 23, 2004, at 12:44 PM, [EMAIL PROTECTED] wrote:
Let's try to get a little simpler with our approach. Does this grab
what you need?
m/(\W+)$/
James
What a quick response. Thanks.
No problem.
I assume you mean do this? Am I right?
OK. I am reading a file. This line is at the bottom of the
file and the ---** is a sign that the section is complete.
I need to be able to pick up that line, and see if there is
also code on the beginning of that line that I need to save.
So in this case I was searching for
[EMAIL PROTECTED] wrote:
Hi,
I have a string similar to:
Comment: FILING
---
-
This is read in as one line (with the page feed).
I was trying to whatever follows the words and I tried this.
Trying to remove?
Would something like this do the trick?
$_ = $1 if /((\s*\w+:?)+)/;
True. But I need to test the line to see if it contains
those '*--**'. Otherwise how do I know that
the line needs to be edited.
(I am reading a file with many lines. I have to
detect when the line comes with
On Jun 23, 2004, at 12:59 PM, [EMAIL PROTECTED] wrote:
OK. I am reading a file. This line is at the bottom of the
file and the ---** is a sign that the section is
complete.
This may be a sign that you aren't reading the file in the easiest
possible way. I wonder if setting the
why not to split the String first
something like
foreach my $line (split(/\n/, $a)) {
if ($line =~ /whatever/) {
print $line;
}
}
shall do the trick
Marcos
-Original Message-
From: bzzt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 16, 2004 1:33 PM
To: [EMAIL
On Jun 16, bzzt said:
I'm trying to match a patern in a string but I want to do it a line at a
time. Is there an easier way than this :
while ($a =~ m/(.+?)\n/g ) {
if ($1 =~ /whatever/g) {
print $1;
}
Your regex, /(.+?)\n/, is unnecessarily complex. The ? modifier on .+
isn't
On Jun 14, [EMAIL PROTECTED] said:
$field = Search, This is part of the code.;
I have marked the word boundaries (the places in your string that are
matched by \b) with # signs:
#Search#, #This# #is# #part# #of# #the# #code#.
A word boundary is defined as the position in a string where a word
[EMAIL PROTECTED] wrote:
$field = Search, This is part of the code.;
## We need to split by spaces. The issue is that the comma comes along.
local(@words) = split('\s+', $field);
foreach $word (@words) {
if ($word =~ /Search/i) {
$word =~ s/[,\]\)\}]\b//;
$word =~
On Apr 6, 2004, at 7:46 AM, prabu wrote:
Hi,
Howdy.
I want to match a pattern and replace with another string.Since
the ?
is also one of the character present in the string.
I am not able to do it.
I bet we can fix that.
Please help to how to make ? acceptable in the string used for
On 2004-02-26 00:43:21 +, [EMAIL PROTECTED] (Wolf Blaum) said:
As I understand Biology, there is 4 nucleotid acids which gives 4**2
combinaions for dupplets. So you need 8 vars to count the occourence of
all douplets. Worse for triplets. (24)
As I understand genetics, triplets are what
On Thursday 26 February 2004 12:28, Henry Todd generously enriched virtual
reality by making up this one:
On 2004-02-26 00:43:21 +, [EMAIL PROTECTED] (Wolf Blaum) said:
As I understand Biology, there is 4 nucleotid acids which gives 4**2
combinaions for dupplets. So you need 8 vars to
1 - 100 of 219 matches
Mail list logo