Re: Pattern Matching Question

2005-11-27 Thread John W. Krahn
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

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
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

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
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;

Re: Pattern Matching Question

2005-11-28 Thread Jeff 'japhy' Pinyan
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

question on pattern matching

2006-03-07 Thread Gavin Bowlby
#!/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 =~

Re: regexp pattern matching

2006-06-29 Thread Dr.Ruud
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

Re: regexp pattern matching

2006-06-29 Thread Dr.Ruud
"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,

Re: regexp pattern matching

2006-06-29 Thread Mr. Shawn H. Corey
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

Re: regexp pattern matching

2006-06-29 Thread Mr. Shawn H. Corey
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

Re: regexp pattern matching

2006-06-30 Thread M. Kristall
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+)\): (.*)/) {

Re: pattern matching problems

2006-07-08 Thread Mumia W.
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'

Re: pattern matching problems

2006-07-08 Thread Mumia W.
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

Pattern matching - external website

2002-11-07 Thread Eric Ellsworth
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:

doubt in pattern matching

2003-01-21 Thread kasi ramanathen
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

RE: Pattern matching username

2003-09-30 Thread Hanson, Rob
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?

Re: Pattern Matching Operators

2003-10-05 Thread Zanardi2k3
[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

RE: Pattern Matching Operators

2003-10-05 Thread TN
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

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
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

RE: Pattern matching problem

2004-02-25 Thread Bakken, Luke
> 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

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
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

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
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

Re: Pattern matching problem

2004-02-25 Thread Henry Todd
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

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
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 > > > >

Re: Pattern matching problem

2004-02-25 Thread david
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

Re: Pattern matching problem

2004-02-25 Thread John W. Krahn
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

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
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

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
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

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
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

Re: Pattern matching problem

2004-02-25 Thread WC -Sx- Jones
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) __

Re: Pattern matching problem

2004-02-25 Thread Henry Todd
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)

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
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.

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
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

RE: Pattern matching problem

2004-02-25 Thread David le Blanc
> 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

Re: Pattern matching problem

2004-02-25 Thread wolf blaum
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

Reg. 'repeated pattern' matching

2004-02-25 Thread Balaji Thoguluva
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

Re: Pattern matching problem

2004-02-25 Thread R. Joseph Newton
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 > > > >

Re: Pattern matching problem

2004-02-26 Thread Henry Todd
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

Re: Pattern matching problem

2004-02-26 Thread wolf blaum
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

logical "and" pattern matching

2003-02-19 Thread Gary Merrick
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

Re: pattern matching problems

2003-03-06 Thread Pete Emerson
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

Re: pattern matching problems

2003-03-06 Thread Stefan Lidman
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: > > > &

pattern matching problems 2

2003-03-06 Thread Francesco del Vecchio
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

Trouble with pattern matching

2003-03-11 Thread Francesco del Vecchio
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

Re: pattern matching problems

2003-06-13 Thread Rob Dixon
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

pattern matching in stream...

2003-06-28 Thread Ling F. Zhang
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

Array and Pattern matching

2003-06-30 Thread B. Fongo
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

Re: wildcat pattern matching

2003-07-12 Thread Bryan Harris
> $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]

Re: wildcat pattern matching

2003-07-13 Thread Michele Marcionelli
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,$

Re: wildcat pattern matching

2003-07-13 Thread Michele Marcionelli
> $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); .

Re: wildcat pattern matching

2003-07-13 Thread Jeff 'japhy' Pinyan
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

Re: wildcat pattern matching

2003-07-13 Thread Bryan Harris
>> $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..

Re: Pattern matching problem

2008-02-29 Thread Gunnar Hjalmarsson
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

RE: pattern matching question

2008-09-22 Thread Dave
-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

RE: pattern matching question

2008-09-23 Thread sanket vaidya
- 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

Re: pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
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

RE: pattern matching question

2008-09-23 Thread sanket vaidya
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

Re: pattern matching question

2008-09-23 Thread ANJAN PURKAYASTHA
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

Re: Pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
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

Problem with pattern matching...

2001-07-17 Thread Craig S Monroe
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

Re: Pattern matching problem

2001-09-20 Thread Sudarsan Raghavan
/^$/ 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

Re: Pattern matching problem

2001-09-20 Thread Pete Sergeant
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

Pattern Matching...last one.

2002-05-09 Thread Batchelor, Scott
$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

RE: Pattern Matching...again...

2002-05-20 Thread Hanson, Robert
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

RE: Pattern Matching...again...

2002-05-20 Thread Batchelor, Scott
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

Re: Serious pattern matching.

2002-06-14 Thread Felix Geerinckx
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

RE: Serious pattern matching.

2002-06-14 Thread Craig Hammer
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

Re: Serious pattern matching.

2002-06-14 Thread John W. Krahn
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

RE: Serious pattern matching.

2002-06-14 Thread Craig Hammer
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

Binary File Pattern Matching

2002-06-24 Thread Andrew Stone
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

Pattern-Matching var - interpolation.

2002-07-19 Thread Angerstein
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

Re: Pattern matching \b

2004-06-14 Thread Jeff 'japhy' Pinyan
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

Re: Pattern matching \b

2004-06-14 Thread Roberto Etcheverry
[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 =~

Query on pattern matching

2007-03-08 Thread Dharshana Eswaran
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

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
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;

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
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]

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
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

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
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

RE: Regarding pattern matching

2007-05-17 Thread Moon, John
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

Re: Regarding pattern matching

2007-05-17 Thread Matthew J. Avitable
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

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
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

Re: Regarding pattern matching

2007-05-24 Thread Jeff Pang
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

Re: Regarding pattern matching

2007-05-24 Thread Dr.Ruud
"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

Doubt on Pattern Matching

2007-08-27 Thread Dharshana Eswaran
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*

"Near match" pattern matching.

2001-11-01 Thread Matt Klicka
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

RE: basic pattern matching

2001-11-09 Thread Gibbs Tanton - tgibbs
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

RE: basic pattern matching

2001-11-09 Thread Wagner-David
, 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

Re: basic pattern matching

2001-11-10 Thread Jonathan E. Paton
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 __

Re: basic pattern matching

2001-11-10 Thread Jonathan E. 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

Re: basic pattern matching

2001-11-10 Thread Brett W. McCoy
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

Re: basic pattern matching

2001-11-13 Thread EternalLifeThereAfter
- 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

Pattern Matching - Remove Alpha

2002-01-16 Thread Hewlett Pickens
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

regex and pattern matching

2002-02-05 Thread PaulD
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";

Re: pattern matching question

2002-02-28 Thread bob ackerman
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

RE: pattern matching question

2002-02-28 Thread Jason Larson
-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

RE: pattern matching question

2002-02-28 Thread Jason Larson
-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

Re: AW: Pattern matching question

2009-04-01 Thread Richard Hobson
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

Re: Perl, pattern matching, substitution

2010-11-13 Thread Shawn H Corey
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

Re: Perl, pattern matching, substitution

2010-11-13 Thread Sheppy R
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

Re: Perl, pattern matching, substitution

2010-11-13 Thread Rob Dixon
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

Perl, pattern matching, substitution, replacing

2010-11-14 Thread Zachary Brooks
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

<    1   2   3   4   5   >