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 sub
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;
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 lon
#!/usr/bin/perl
use warnings;
use strict;
my ($x, $y);
$x = "57 s";
# the following statements fail:
$x =~ /^(\s*)(\d+)(\.)?(\d*)(\s*)(s|S)/;
$y = $1.$2.$3;
# FAILS with "Use of uninitialized value in concatenation (.) or string"
# because $3 is undefined
# whereas these statements pass:
$x =~
Hair schreef:
> Hello, I have a pattern matching question, that I can't seem to find
> the answer to either online or in books, so here is the pattern I am
> trying to match, and hopefully some kind soul will give me pointers:
>
>
> The satchel contains the following items
"Dr.Ruud" schreef:
> You're problem might be that you use the () unescaped.
Hihi, that's what you get when you shift from
You're probably ...
to
Your problem ...
mid-sentence.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
On Thu, 2006-29-06 at 13:40 -0400, Hair wrote:
> Hello, I have a pattern matching question, that I can't seem to find the
> answer to either online or in books, so here is the pattern I am trying to
> match, and hopefully some kind soul will give me pointers:
>
>
> T
On Thu, 2006-29-06 at 14:31 -0400, Mr. Shawn H. Corey wrote:
> OK, here are some pointers:
>
> 1. Create a file with lines you want to match. Use copy & paste rather
> than generating them by hand; you'll avoid typing errors. Try to include
> as many just-barely-hits as you can, that is, those lin
Mr. Shawn H. Corey wrote:
m/The satchel contains the following items? \((\d+)\): (.*)/
my $count_of_items = $1;
my $item_list = $2;
And don't forget to check if it matched (otherwise you have the old $1
and $2):
if (m/The satchel contains the following items? \((\d+)\): (.*)/) {
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 ch
Hi, I'm writing a program that parses through existing files on a website and
converts links to be rerouted through another program.
I'd like to skip external websites, and I'm having a bear of a time with the
matching string. Specifically, what I'd like to do is match any url that
includes:
dear friends:
i have a simple doubts in reguler exepration see the the passage that follows is
stored in a variable by name v. in the fifth line see the words like this "Next 20 ^ "
now i want delete all the charecter before ^- sign in my variable v.
shall i use find and replace to find all th
ou need to specify the dash (-), it isn't included in \w.
Rob
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 1:30 PM
To: [EMAIL PROTECTED]
Subject: Pattern matching username
Is this doing what it is suppose to and how efficient?
[EMAIL PROTECTED] (Prasad Karpur) wrote:
> Is there a similar operator in Perl for ${variable##pattern} as there
> is in korn shell.
Not knowing korn shell, i'm not sure if this is what you want, but there is
a Pattern Matching Operator in perl, and it is the "m//" opera
pod/perlre.html)
In any case, it apears that ksh offers a limited capability of substring
processing through 4 varieties of parameter expansion ( (prefix,suffix)
by (smallest,largest) ). The ksh documentation says "pattern matching
notation (see patmat), rather than regular expression notation, will
On Wed, Feb 25, 2004 at 04:35:57PM +, Henry Todd ([EMAIL PROTECTED]) wrote:
> I'm having trouble counting the number of specific substrings within a
> string. I'm working on a bioinformatics coursework at the moment, so my
> string looks like this:
If you don't get an answer to your question
> I'm having trouble counting the number of specific substrings
> within a
> string. I'm working on a bioinformatics coursework at the
> moment, so my
> string looks like this:
>
> $sequence = "caggaactttcggaagaccatgta";
>
> I want to count the number of occurrences of each pair of
> let
Kenton Brede wrote:
>
> > I'm having trouble counting the number of specific substrings within a
> > string. I'm working on a bioinformatics coursework at the moment, so my
> > string looks like this:
>
> If you don't get an answer to your question this is probably why -
>
> http://learn.perl.org/b
On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> Kenton Brede wrote:
> >
> > > I'm having trouble counting the number of specific substrings within a
> > > string. I'm working on a bioinformatics coursework at the moment, so my
> > > string looks like this:
> >
> > I
On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said:
If you don't get an answer to your question this is probably why -
http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list%20_not_%20for
Kent
Kent
Kent
Kent -
Thanks for the pointer. I should have read the list
Kenton Brede wrote:
>
> On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> > Kenton Brede wrote:
> > >
> > > > I'm having trouble counting the number of specific substrings within a
> > > > string. I'm working on a bioinformatics coursework at the moment, so my
> > > >
Henry Todd wrote:
[snip]
>
> This is how I'm counting the number of "cc" pairs at the moment ($cc is
> my counter variable):
>
> $cc++ while $sequence =~ /cc/gi;
>
> But this only matches the literal string "cc", so if, as it scans
> $sequence, it finds "" it's only counting it once instea
Henry Todd wrote:
>
> I'm having trouble counting the number of specific substrings within a
> string. I'm working on a bioinformatics coursework at the moment, so my
> string looks like this:
>
> $sequence = "caggaactttcggaagaccatgta";
>
> I want to count the number of occurrences of each p
Henry Todd wrote:
>
> On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said:
>
> > If you don't get an answer to your question this is probably why -
> >
> > http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list%20_not_%20for
>
> Thanks for the pointer. I should have re
On Wed, Feb 25, 2004 at 06:30:55PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> Kenton Brede wrote:
> >
> > On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> > > Kenton Brede wrote:
> > > >
> > > > > I'm having trouble counting the number of specific substrings withi
On Wed, Feb 25, 2004 at 06:12:55PM +, Henry Todd ([EMAIL PROTECTED]) wrote:
> On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said:
>
> >If you don't get an answer to your question this is probably why -
> >
> >http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list
Kenton Brede wrote:
I just didn't want the OP to be hanging waiting for an answer when non
would be forthcoming.
Not a mistake per se -- however Perl people (read POD) will always want
to show off -- so, if it is Perl, it is likely answered.
:)
-Sx-
(let's not mention cpl.mod)
__
Hi all -
Many thanks to those who shared their knowledge. I had a feeling that
there would be an elegant solution to my problem, but I was having no
luck figuring it out.
For reference, where before my code was:
$Pcc++ while $sequence =~ /cc/gi;
..it is now:
$Pcc++ while $sequence =~ /c(?=c)
Kenton Brede wrote:
>
> OK my mistake. I've been on newsgroups/lists where the "no homework rule"
> is enforced and just assumed the FAQ was literal, except for the
> "monkey" parts of course.
>
> I just didn't want the OP to be hanging waiting for an answer when non
> would be forthcoming.
Hmm.
Kenton Brede wrote:
>
> Well it seems there is confusion on my part as to which part of the FAQ
> to follow. I'm sure there are tons of homework questions done for people
> who disguise them. That is one reason I've always felt the "no homework
> rule" is superfluous. Personally I have no proble
> From: Bakken, Luke [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 26 February 2004 4:59 AM
> To: Henry Todd; [EMAIL PROTECTED]
> Subject: RE: Pattern matching problem
>
> > I'm having trouble counting the number of specific substrings
> > within a
> > s
On Wednesday 25 February 2004 17:35, Henry Todd generously enriched virtual
reality by making up this one:
Hi,
> I'm having trouble counting the number of specific substrings within a
> string. I'm working on a bioinformatics coursework at the moment, so my
> string looks like this:
>
> $sequen
Hi,
I have a question on pattern matching. Assume I have a line like this consisting
of header field(via) and values(IPaddress) repeated like below
via: 192.168.6.100; via:192.168.6.101; via: 203.290.89.90; ..so on
I would like to know how many via: header field occur and to get
Kenton Brede wrote:
> On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote:
> > Kenton Brede wrote:
> > >
> > > > I'm having trouble counting the number of specific substrings within a
> > > > string. I'm working on a bioinformatics coursework at the moment, so my
> > > >
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 matte
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
Ok, so this is probably a stupid question, but I'm a newbie, and therefore
stupid. :-] It'll take you about 5 seconds to figure this one out.
I have an assignment that requires me to find words in a dictionary that contain
all five vowels (a, e, i, o, and u). I've figured out the logical "or" p
On Thu, 2003-03-06 at 09:32, Francesco del Vecchio wrote:
> If I have a string as the following:
> a xx b a x b
> and I try a m/a(.*)b/g
> $1 = xx b a x
> what have I to do to obtain two matches each of one give me
> $1 = x
#!/usr/bin/perl -w
u
hing
* match what is before it 0 or more times
? make matck non gready
/Stefan
Francesco del Vecchio wrote:
>
> Hi to all,
>
> Im new to the list and to the Perl too...and I've some problems with pattern
> matching.
>
> from a string of this kind:
>
>
>
&
Here I am again ^_^
thanks a lot for the previous answers...they solved my problem.
I have another problem of the same kind...let me explain:
=
String " bb=somestuff someotherstuff"
I don't know what "somestuff" and "someotherstuff" are...I only kn
I have this string:
I would like to replace the background adding the absolutepath. So I write this code
$tosubstitute = url($4,$baseurl)->abs->as_string;
$tosubstitute =qq($tosubstitute);
$line =~ s{background(\s?)(=?)(\"?)(.*?)(\"?)\s}{background=$tosubstitute }i;
checking the $tosubstitute
Chern Jian Leaw wrote:
> HI,
> I have a script attached in this mail which reads the output of rpcinfo and
> tokenizes its outputs. This problem is similar to my earlier posting a few
> days ago. However, in this scenario, the some outputs of rpcinfo response
> i.e. "rpcinfo: RPC: Timed out progr
I have the following problem:
I just read in a file ...
in ONE of line of the file, there is a word I need to
substitute...
but I realize that:
$a = would assign $a the first line of the file
@a = world assign each line of the file as an
element of @a...
now...s/search/replace/ only works for st
Hi
I have a file containing arrays of numbers. I 'm trying to get a
subroutine iterate the file and print ONLY arrays with three elements
into a second file. None of the elements has more than 2 digits. So I
tried with a pattern match, it fails to deliver the right result.
I want it to find and
> $tmp =~ /.*?<\/artist>/;
> $artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9);
Have you tried this?
$tmp =~ /(.*)<\/artist>/;
$artist = $1;
- B
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hello Ling,
> I am doing an xml parser to manage my list of
> mp3s...say after reading my xml file, my variable
> reads:
> $tmp = 'artist#1
> songtitle...'
>
> anyway, you get the idea...now, I want to extract the
> artist...so I do:
>
> $tmp =~ /.*?<\/artist>/;
> $artist = substr($tmp,$-[0]+8,$
> $tmp = 'artist#1
> songtitle...'
If you define this function:
sub get_container {
local ($name, $src) = @_;
$src =~ m/<$name>(.*?)<\/$name>/i;
return $1;
}
Then you can use it as follow:
$artist = get_container('artist', $tmp);
$artist = get_container('title', $tmp);
.
On Jul 12, Ling F. Zhang said:
>I am doing an xml parser to manage my list of
>mp3s...say after reading my xml file, my variable
>reads:
>$tmp = 'artist#1
>songtitle...'
It might be wiser to use a real XML parser (written in Perl, of course)
instead of writing your own regexes to deal with your i
>> $tmp =~ /.*?<\/artist>/;
>> $artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9);
>
> How on EARTH did you learn about the @- and @+ arrays, WITHOUT learning
> about the $1, $2, $3, etc. variables? Honestly, which regex tutorial have
> you been using?
What are @- and @+? I've never heard of those..
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
-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
-
From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2008 6:52 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 sequences ie they are exclusivel
mn also happens to have other strings that are made of
> word/digit/space characters.
> i tried
> if($x=~ /[ATGC]/ )then .
> however this pattern matching expression is unable to filter out the non-DNA
> sequences.
> i have also tried other expressions too convoluted to writ
age-
From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2008 6:52 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 sequences ie they are exclus
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 a
On Tue, 2008-09-23 at 14:05 -0700, Darren Nay wrote:
> Here is the string:
> 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 and retrieve the value of
> doctype-sys
All,
I am trying to make sure that if feature 5 is selected, that it needs to
have a colon and a number after it.
I cannot seem to find the reference to not equaling a pattern match I was
testing for three things.
1. if $feature has a 5 in it
and
2. if $feature does have a 5 in it, make sure it
/^$/ matches a blank line, /^\$/ will do the job for you.
$ is a metacharacter, you will have to escape it. It matches at the end of a
line or before newline at the end.
hth.
Sudarsan
Tanya Bar wrote:
>
> Path could be physical or start with environment variable; so in my script
> I'm trying
Some other notes...
You don't have to use printf - you can use print. And you don't need the
brackets, or the inverted commas around $path:
if ($path =~ m/^\$/) {
print "Path is env var\n";
} else {
print "Working on phys.dir\n";
}
> > if ( "$path" =~ /^$/ ) {
> >printf("p
$value =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg;
this is saying substitute any alpha, non-alpha characters with the
hexadecimal string of $1.
I am not sure what the "%" sign does or the "eg"
Again, thanks in advance.
Scott
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
ilto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 5:40 PM
To: '[EMAIL PROTECTED]'
Subject: Pattern Matching...again...
I am trying to match a word in a string. I am using to variables here is my
small piece of code that should be doing this.
If ($var1 =~ /\b$var2?\b/I) {
Pr
helor, Scott'; '[EMAIL PROTECTED]'
Subject:RE: Pattern Matching...again...
A few things...
If ($var1 =~ /\b$var2?\b/I) {
^^ it should be "if" not "If"
If ($var1 =~ /\b$var2?\b/I) {
^ The switch is "i" not "I"
Pr
on Fri, 14 Jun 2002 05:42:04 GMT, [EMAIL PROTECTED] (Langa
Kentane) wrote:
> Greetz,
> I need some help with IP address matching. For instance I have a
> log with an IP address 10.3.2.1 and 10.3.4.5. I want to match all
> IP addresses in the 10.3.0.0 mask 255.255.0.0 range. How would I
> do this
Langa,
Take a look at this script. I created it to read my firewall log files, and
then give me a sort and count per unique address. You could substitute a
more traditional grep in place of the substitution I use.
<>
Craig Hammer
Internal Infrastructure Team Lead
Parago, Inc.
972-538-3936
Craig Hammer wrote:
>
> Take a look at this script. I created it to read my firewall log files, and
> then give me a sort and count per unique address. You could substitute a
> more traditional grep in place of the substitution I use.
>
>
> opendir(DIR, "/clog1") || die("Unable to open logdir
John,
Thanks for the optimized version. The outfile isn't used yet. I have it
sitting there because that is the next step.
Craig Hammer
Internal Infrastructure Team Lead
Parago, Inc.
972-538-3936
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTE
Hello all,
I'm having a problem with (I suppose) pattern matching.
Here's the task: To take binary data from windows(little-endian)
and convert to Unix(big-endian). If the file is all numeric, I don't
have a problem, but it isn't. I need to be able to recognize that
one
Hello,
I have a very unfunny problem, on which i am working for hours.
I need to find out if a string contains an other specified string.
I want to use pattern-matching.
I can´t get a match together which make this. Look at my examples,
none of the Matchings using vars works. If I replaces the
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 wor
[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 =~
mal number too.
the 3rd string is sometimes is not present.
Once these are extracted, i can process it further to the requirement.
I tried reading each line, splitting it using spaces, grouping them using
pattern matching and then displaying. The code, which i wrote for this, is
written at the
How about this?
#!/usr/local/bin/perl
use strict;
use warnings;
my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY +
0x01) /* @LOG MNSS_MESSAGE_T */';
my @parts = $string =~ m/\S+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED](\w+).*/;
use Data::Dumper;
print Dumper @parts;
On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote:
How about this?
#!/usr/local/bin/perl
use strict;
use warnings;
my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY
+ 0x01) /* @LOG MNSS_MESSAGE_T */';
my @parts = $string =~ m/\s+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED]
Thank you But i want to try without using any perl modules. Can you
suggest some way with no modules used in that?
Thanks and Regards,
Dharshana
On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote:
On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote:
>
> How about this?
>
>
> #!/usr/local/bin/pe
Sure, though I do not see why you would not want to use strict and warnings
(you should should should or the people on this list will hunt you down and
) anyway Data::Dumper was just there for convenience:
#!/usr/local/bin/perl
#use strict;
#use warnings;
my $string = '#define MNSS_FACILIT
Subject: Regarding pattern matching
Hi All,
I am trying to extract few strings from a text file. The pattern of the
text
stored in the file is as follows:
#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /*
@LOG
MNSS_MESSAGE_T */
I need to extract MNSS_FACILITY_IND_ID
Dharshana Eswaran wrote:
Hi All,
I am trying to extract few strings from a text file. The pattern of
the text
stored in the file is as follows:
#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01)
/* @LOG
MNSS_MESSAGE_T */
I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_ME
Of Course Rob, i always use strict and warnings... Since i had to write a
pseudocode, i did not write them. But i wil lsurely keep this in mind. :-)
Thank you... :-)
On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote:
Sure, though I do not see why you would not want to use strict and
warnings (you
Dharshana Eswaran 写道:
Hi All,
I am trying to extract strings from few files. The content of the file
reads
as shown
typedef struct
{
REFID_T pp_ref_id; /* destination */
CAUSE_T pp_cause;/* Reason registered */
STATE_T pp_state; /* State for i
"Dharshana Eswaran" schreef:
> $xyz =~ /\s*(\w+)\s+(\w+);/;
> $b = $2; #variable name is stored here
>
> ...
>
> But the variables like pp_lac[COMMON_TYPE_MAX] and
> pp_plmn_list[COMMON_TYPE_MAX] are not getting stored because of the
> special character used inbetween the names.
The
Hi All,
I have a pattern, which reads as shown below:
my $comment= qr{\s* (?:/\* .*? \*/ \s*)*}xs;
my $identifier = qr{ [A-Za-z_]\w* }xs;
my $statement = qr{
\s*
($identifier)
\s+
($identifier)
\s*
I'm looking for some ideas on how to do a "near match"
or "fuzzy logic" pattern match. Something that will
say, for example, that two strings 80% match. I was
thinking that spell checkers and search engines use
this kind of thing all the time. Do they have a really
repetative match (or a really co
quot;;
print "2" if "chris" =~ /chris/;
print "3" if "chris" =~ /^chris$/;
This will print out 123.
You can look at perldoc perlre for regular expression help and
perldoc perlop for help on eq and its relatives.
Hope this helps!
Tanton
-Original Messa
, November 09, 2001 15:46
To: [EMAIL PROTECTED]
Subject: basic pattern matching
Hi gurus!
I am traversing a multidimensional hash searching for a value and
trying to delete it. However, I am ending up deleting the wrong one.
The value I'm looking for is /name/. There is also a value of /name1
Hi,
The problem reduced to a level I can solve:
Match "name"
but not "name1" etc
Solution:
Use ^ and $ assertions
where ^ matches start of string
and where matches end of string
hence use /^name$/
Hope that is clear enough :)
Jonathan Paton
__
Hi,
> where ^ matches start of string
> and where matches end of string
Should be "and where $ matches end of string.
Jonathan Paton
__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music
Charts
ht
On Fri, 9 Nov 2001, HANSON wrote:
> I am traversing a multidimensional hash searching for a value and
> trying to delete it. However, I am ending up deleting the wrong one.
> The value I'm looking for is /name/. There is also a value of /name1/
> in the hash. When I use =~/name/ it deletes the na
- Original Message -
From: "Gibbs Tanton - tgibbs" <[EMAIL PROTECTED]>
To: "'HANSON '" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, November 10, 2001 8:06 AM
Subject: RE: basic pattern matching
> You can look at perld
I am unable to use "split" with pattern matching to remove alpha characters
from a string and will appreciate a pointer on what I'm doing wrong. (Have
looked in "Learning Perl" and "Programming Perl" but can't spot my error.)
The detail:
"$stat&qu
Hi All,
Trying to figure out something that should be easy..
If $value_a contains $value_b then
Problem is I don't know how to escape the entire variable $value_a so that
the . is not considered a quantifier.
$value_a = ".com";
On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote:
> while (defined($Line=)){
> if($Line=~/(\(D\d+\))\s*(\w*)/){
> print "==> $2\n";
> };
> };
>
disclaimer: i am a rank newbot
if i replace '/w*' with '.*$'
i get desired text.
looks like \w* doesn't do what we expect.
probl
-Original Message-
From: richard noel fell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 10:38 AM
To: [EMAIL PROTECTED]
Subject: pattern matching question
I have the following bit of code:
#!/usr/bin/perl -w
open In2,"/home/rfell/tutoring/beaven/webproject/tmp/maxim
-Original Message-
From: bob ackerman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 11:32 AM
To: richard noel fell
Cc: [EMAIL PROTECTED]
Subject: Re: pattern matching question
On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote:
> while (defined($L
Firstly, apologies for the double posting of this question.
On Wed, 01 Apr 2009 09:49 +0200, "Thomas Bätzler"
wrote:
> How about (untested):
>
> sub display_board {
> foreach my $ref (@_){
> foreach my $piece ( @$ref ){
> print substr( $piece, -2);
> }
> }
> }
>
> The Perl wa
On 10-11-13 01:42 PM, Zachary Brooks wrote:
1. My first approach was to use substitute to get rid of a range of things
between and. A short version looks like this.
$hello = " man at the bar order the";
$hello =~ s/.*<\/DATELINE>//gi;
print "$hello\n";
I was about to say that you should use
I've had similar issues and the \Q \E flags didn't fix it.
One thing I've done to fix an issue where regex metacharacters are being
caught is to do a replace on all of the characters to include a \ right in
front.
Something like this:
open (my $FILE, "<", $file) or die "$!\n";
my @lines = <$FILE
On 13/11/2010 18:42, Zachary Brooks wrote:
Hello,
I'm taking a PhD course that requires the use of Perl and pattern matching.
I've taken on the motto "divide and conquer," but it hasn't quite worked. I
appreciate anyone's help.
The task is to extract sentences fro
Hello again,
Yesterday I had a question on pattern matching. A couple of people responded
with very useful information. After some finagling, I got my rudimentary
code to work. I'm a PhD student studying computational linguistics without
any formal programming training. While there are va
201 - 300 of 474 matches
Mail list logo