Re: A Regular Expression Problem in Perl 5.28

2023-03-29 Thread Jim Gibson via beginners
On Mar 28, 2023, at 3:00 PM, Martin McCormick wrote: > > Uri Guttman writes: >> yes, but he kept the {5,} repeat count. so i just kept it too. > > Now that I know how this works, I will probably change to > {4,} as this would match 4 or more digits. From reading the > documentation, {4} means

Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Martin McCormick
Uri Guttman writes: > yes, but he kept the {5,} repeat count. so i just kept it too. Now that I know how this works, I will probably change to {4,} as this would match 4 or more digits. From reading the documentation, {4} means 4 and only 4. {4,6} means 4 but nothing else except 6. {N,}

Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Martin McCormick
Uri Guttman writes: > you also quoted the whole regex in '' but included the // which are the > normal regex delimiters. remove the outer quotes. > and use the qr// form for regexes. > and you don't want the + after the \d as the {5,} is the count. you can't > have both types of repeat counts. > m

Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Sam
On 3/28/23 16:07, Uri Guttman wrote: On 3/28/23 17:01, Martin McCormick wrote: Uri Guttman writes: why are you escaping the {}?? those are meta chars that are needed to make that a 5+ range. just delete the backslashes on them and it will work. First, thank you but read on, please. I

Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Martin McCormick
Uri Guttman writes: > why are you escaping the {}?? those are meta chars that are needed to make > that a 5+ range. just delete the backslashes on them and it will work. First, thank you but read on, please. I couldn't agree more. That should do it but when I don't escape them, I

Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Uri Guttman
On 3/28/23 16:17, Martin McCormick wrote: The string I am interested in testing for starts with 5 or 6 digits in a row and all I need to do is determine that the first 5 or 6 characters are numbers Period. That's all. my $regextest = '/^\d+\{5,\}/' ; why are you escaping the {}?? th

A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Martin McCormick
I've been fighting this for several days and it is a very simple regular expression problem that should be easy enough for a second grader but I can't seem to get it to work. The string I am interested in testing for starts with 5 or 6 digits in a row and all I need to do is

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-09 Thread Gautam Desai
Thanks a lot Gautam S Desai On Sun, Sep 8, 2019 at 6:39 PM Mike wrote: > > It's probably best if you write a short script > that reads a __DATA__ section of data. > Then tell us what it does and what you expected > it to do. > > Off hand I don't see anything wrong with your regex, > but I do

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
> On Sep 8, 2019, at 6:36 PM, Olivier wrote: > > Jim Gibson writes: > >> On Sep 8, 2019, at 3:39 PM, Mike wrote: >>> >>> >>> It's probably best if you write a short script >>> that reads a __DATA__ section of data. >>> Then tell us what it does and what you expected >>> it to do. >>> >>>

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Olivier
Jim Gibson writes: > On Sep 8, 2019, at 3:39 PM, Mike wrote: >> >> >> It's probably best if you write a short script >> that reads a __DATA__ section of data. >> Then tell us what it does and what you expected >> it to do. >> >> Off hand I don't see anything wrong with your regex, >> but I do

regular expression

2019-09-08 Thread Mike
You are not doing anything with $t to test whether it works.  Also you are not telling us what data you might test it with. Mike On 9/8/2019 6:41 PM, Jim Gibson wrote: On Sep 8, 2019, at 3:39 PM, Mike wrote: I expect it to return a positive value if $t contains a number anywhere within i

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
On Sep 8, 2019, at 3:39 PM, Mike wrote: > > > It's probably best if you write a short script > that reads a __DATA__ section of data. > Then tell us what it does and what you expected > it to do. > > Off hand I don't see anything wrong with your regex, > but I don't know what you expect it to d

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Mike
It's probably best if you write a short script that reads a __DATA__ section of data. Then tell us what it does and what you expected it to do. Off hand I don't see anything wrong with your regex, but I don't know what you expect it to do. Mike On 9/8/2019 4:34 PM, Jim Gibson wrote: On Sep

Re: Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Jim Gibson
On Sep 8, 2019, at 1:30 PM, Gautam Desai wrote: > > Do you guys have any pointers ? $t =~ m{ ( # capture matched number in $1 \d* # match zero or more decimal digits [05] # followed by a '0' or '5' )

Hi Folks : I'm trying to create a regular expression for finding a # wishing a dataset for only a number that is a multiple of 5

2019-09-08 Thread Gautam Desai
Do you guys have any pointers ? Thanks Gautam S Desai kidsforchess.org https://www.facebook.com/kidsforchess.suwanee.9 https://www.21stcenturyleaders.org/youth-ambassador-starts-nonprofit-donates-to-21cl/

Re: Removing a Pattern using a Regular Expression

2018-06-14 Thread John W. Krahn
On Wed, 2018-06-13 at 21:21 -0500, Martin McCormick wrote: > I wrote a small perl program to more quickly read all the > subjects in an email list.  One of the things the script does is > to remove the mailing list name which repeats for every message > and consists of a [, some English text and fi

Re: Removing a Pattern using a Regular Expression

2018-06-14 Thread Shlomi Fish
Hi Dmitri, On Thu, 14 Jun 2018 11:34:34 +0300 Дмитрий Ананьевский wrote: > On Wed, 13 Jun 2018 21:21:12 -0500 > "Martin McCormick" wrote: > > > I wrote a small perl program to more quickly read all the > > subjects in an email list. One of the things the script does is > > to remove the maili

Re: Removing a Pattern using a Regular Expression

2018-06-14 Thread Shlomi Fish
Hi, On Wed, 13 Jun 2018 21:21:12 -0500 "Martin McCormick" wrote: > I wrote a small perl program to more quickly read all the > subjects in an email list. One of the things the script does is > to remove the mailing list name which repeats for every message > and consists of a [, some English te

Re: Removing a Pattern using a Regular Expression

2018-06-14 Thread Дмитрий Ананьевский
On Wed, 13 Jun 2018 21:21:12 -0500 "Martin McCormick" wrote: > I wrote a small perl program to more quickly read all the > subjects in an email list. One of the things the script does is > to remove the mailing list name which repeats for every message > and consists of a [, some English text an

Removing a Pattern using a Regular Expression

2018-06-13 Thread Martin McCormick
I wrote a small perl program to more quickly read all the subjects in an email list. One of the things the script does is to remove the mailing list name which repeats for every message and consists of a [, some English text and finally a ]. I was able to write a RE that identifies that t

Re: Perl regular expression for implementing infix expression parser?

2016-08-14 Thread Richard Heintze via beginners
np = qr{ \( (?: (?> [^()]+ ) | (??{ $np }) )* \) }x;$funpat = qr/$np/;} s/($funpat)=($funpat|(")[^\"]* (")|[0-9\.]+)/"$1=$3".eval($1) ."$4"/ge' That $np is from the camel book and it is a regular expression that parses nested sets of parentheses

Re: Perl regular expression for implementing infix expression parser?

2016-08-14 Thread David Mertens
ions in VI and emacs/VI > emulator mode: > > > > .! perl -MPOSIX -pe ' BEGIN{ $np = qr{ \( (?: (?> [^()]+ ) | (??{ $np }) > )* \) }x;$funpat = qr/$np/;} s/($funpat)=($funpat|(")[^\"]* > (")|[0-9\.]+)/"$1=$3".eval($1)."$4"/ge' > > T

Perl regular expression for implementing infix expression parser?

2016-08-13 Thread Richard Heintze via beginners
uot;$4"/ge' That $np is from the camel book and it is a regular expression that parses nested sets of parentheses and then my replace command evaluates the arithmetic expression. Since perl accommodates recursive regular expressions, it ought to be possible to implement a recursive decent

Re: Regular Expression Help.

2015-03-25 Thread Frank Vino
ake a look at chromatic's Modern Perl, which is > available for free [2]. > > Regards, Simon > > Am 25.03.2015 um 06:01 schrieb Frank Vino: > > Hi Team, > > > > How to understand Regular Expression in a easy way? > > > > Thanks, > > Frank > >

Re: Regular Expression Help.

2015-03-25 Thread Shawn H Corey
On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > > Thanks, > Frank Sorry Frank but there's no easy way. ☹ Some things to remember: Some punctuation marks have special meaning, like perio

Re: Regular Expression Help.

2015-03-25 Thread Simon Reinhardt
Am 25.03.2015 um 06:01 schrieb Frank Vino: > Hi Team, > > How to understand Regular Expression in a easy way? > > Thanks, > Frank [1] Learning Perl, Sixth Edition by Randal L. Schwartz, brian d foy, and Tom Phoenix [2] http://onyxneon.com/books/modern_perl/ --

Re: Regular Expression Help.

2015-03-24 Thread Shlomi Fish
Hi Frank, On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > This page has links to some recommended tutorials about learning regular expressions: http://perl-begin.org/topics/regular-expressions/ *NOTE*:

Re: Regular Expression Help.

2015-03-24 Thread Rahul Gojame
AM, Frank Vino wrote: > >> Hi Team, >> >> How to understand Regular Expression in a easy way? >> >> Thanks, >> Frank >> > >

Re: Regular Expression Help.

2015-03-24 Thread Akshay Mohit
Just start using it and you will find it very easy to understand. -Akshay On Wed, Mar 25, 2015 at 10:31 AM, Frank Vino wrote: > Hi Team, > > How to understand Regular Expression in a easy way? > > Thanks, > Frank >

Regular Expression Help.

2015-03-24 Thread Frank Vino
Hi Team, How to understand Regular Expression in a easy way? Thanks, Frank

RE: Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Viet-Duc Le
Dear Jing, I was confused when I started out the regular expression. Many thanks for the kind and detailed explanation. After reading more on perl regex, I think I have a better grasp of the greedy/non-greedy concept now. Your code also worked well for my task. Regards, Viet-Duc

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Uday Vernekar
when i change use 5.16.0; to use feature ':5.10'; it works i get following output bash-4.2$ ./regex.pl Use of uninitialized value $3 in say at ./regex.pl line 7, line 1. Use of uninitialized value $4 in say at ./regex.pl line 7, line 1. Video1280x720 Use of uninitialized value $2 in say at ./re

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Jing Yu
On 17 Sep 2014, at 17:08, Uday Vernekar wrote: > When i run this script i get following Error > > bash-4.2$ ./regex.pl > feature version v5.16.0 required--this is only version v1.160.0 at ./regex.pl > line 4. > BEGIN failed--compilation aborted at ./regex.pl line 4. > > > > But I am using p

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Uday Vernekar
When i run this script i get following Error bash-4.2$ ./regex.pl feature version v5.16.0 required--this is only version v1.160.0 at ./ regex.pl line 4. BEGIN failed--compilation aborted at ./regex.pl line 4. But I am using perl version as swon below. bash-4.2$ perl -v This is perl 5, version

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-16 Thread Jing Yu
Hi Viet-Duc Le, On 17 Sep 2014, at 10:23, Viet-Duc Le wrote: > Greeting from S. Korea ! > > I am parsing the output of ffmpeg with perl. Particular, I want to print only > these lines among the output and capturing the resolution, i.e. 1280x720. > > Stream #0:0: Video: h264 (High), yuv42

Regular expression: option match after a greedy/non-greedy match

2014-09-16 Thread Viet-Duc Le
p{margin:0;padding:0;} Greeting from S. Korea ! I am parsing the output of ffmpeg with perl. Particular, I want to print only these lines among the output and capturing the resolution, i.e. 1280x720. Stream #0:0: Video: h264 (High), yuv420p, 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.9

RE: regular expression

2014-05-06 Thread Vishal Gupta
Please find below the tested code, same regular expression match both the patterns: my $string1 = "^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms"; my $string2 = "^Modifications made by danwong on 2014/05/06 18:27:48 from database brms"

Re: regular expression

2014-05-06 Thread Uri Guttman
On 05/07/2014 01:40 AM, John SJ Anderson wrote: my @strings = ( "^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms" , "^Modifications made by danwong on 2014/05/06 18:27:48 from database brms²", ); foreach my $string ( @strings ) { my( $match ) = $s

Re: regular expression

2014-05-06 Thread John SJ Anderson
On Tue, May 6, 2014 at 10:30 PM, Danny Wong (dannwong) wrote: > Both string are possible outputs, so I want to be able to grep for the > username only. Well, if the username will always be either the only thing between 'by' and 'on', or in parens if it's not... #! /usr/bin/env perl use strict;

Re: regular expression

2014-05-06 Thread shawn wilson
2014/05/06 18:27:48 from > database brms²; > > What is a regular expression where I can extract ³danwong² from either > string (one string have () parentheses and the other doesn¹t have > parentheses)? > I think you want to anchor on 'made by' and either match between

Re: regular expression

2014-05-06 Thread Danny Wong (dannwong)
eses gives me this output. $1 is Danny Wong (danwong yes the last ) is missing, so it looks like I’m close, I’m not exactly sure what is missing. On 5/6/14, 10:25 PM, "John SJ Anderson" wrote: >On Tue, May 6, 2014 at 10:19 PM, Danny Wong (dannwong) > wrote: > >> What

Re: regular expression

2014-05-06 Thread John SJ Anderson
On Tue, May 6, 2014 at 10:19 PM, Danny Wong (dannwong) wrote: > What is a regular expression where I can extract ³danwong² from either > string (one string have () parentheses and the other doesn¹t have > parentheses)? I'm not entirely sure what you're trying to acco

regular expression

2014-05-06 Thread Danny Wong (dannwong)
Hi Guys, I have the following strings. my $str1="^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms"; #$str1="^Modifications made by danwong on 2014/05/06 18:27:48 from database brms²; What is a regular expression where I can extract

Re: Regular expression help pls !

2013-08-23 Thread jet speed
Chaps, I am testing all your code one by one, Appreciate your time and detailed inputs. Many Thanks Sj On Fri, Aug 23, 2013 at 6:01 PM, Jim Gibson wrote: > > On Aug 23, 2013, at 9:06 AM, jet speed wrote: > > > Chaps, > > > > Please i need help on the regular ex

Re: Regular expression help pls !

2013-08-23 Thread Jim Gibson
On Aug 23, 2013, at 9:06 AM, jet speed wrote: > Chaps, > > Please i need help on the regular expression, i have the sample code below. > I only want to match the entries from the array to the file and print the > matching line > > for example if i only want to match

Re: Regular expression help pls !

2013-08-23 Thread Nathan Hilterbrand
See sample code below > Chaps, > > Please i need help on the regular expression, i have the sample code > below. > I only want to match the entries from the array to the file and print > the > matching line > > for example if i only want to match fc3/23, in my code i

Re: Regular expression help pls !

2013-08-23 Thread David Precious
On Fri, 23 Aug 2013 17:06:41 +0100 jet speed wrote: > Chaps, > > Please i need help on the regular expression, i have the sample code > below. I only want to match the entries from the array to the file > and print the matching line > > for example if i only want to match

Re: Regular expression help pls !

2013-08-23 Thread Shawn H Corey
On Fri, 23 Aug 2013 17:06:41 +0100 jet speed wrote: > my @check = (fc3/23, fc10/1, fc3/14, fc12/12); my @check = qw( fc3/23 fc10/1 fc3/14 fc12/12 ); > > my $f2 = 'out.txt'; > for my $element(@check) { > open my $fh2, '<', $f2 or die "could not open $f2: $!"; > while (my $line = <$fh2>) { > cho

Re: Regular expression help pls !

2013-08-23 Thread Gianrossi, Paolo
Not sure I get it, but would /^fc3\/2\b/ (assuming you're looking for fc3/2 and not fc3/23) work? hth paolino On 23 Aug 2013, at 17:06, jet speed wrote: > Chaps, > > Please i need help on the regular expression, i have the sample code below. > I only want to match the

Regular expression help pls !

2013-08-23 Thread jet speed
Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the entries from the array to the file and print the matching line for example if i only want to match fc3/23, in my code it prints both the lines fc3/2 and fc3/23. How to restrict to exact

Re: t character in regular expression

2012-10-25 Thread Uri Guttman
On 10/25/2012 05:24 PM, Andy Bach wrote: On Thu, Oct 25, 2012 at 3:57 PM, Weidner, Ron wrote: In the following regex what is the "t" character doing? $linebuf =~ tr/\n/:/; tr/// is the "translate", er, transliteration operator. Same as "y///" - from/like a unix util ("tr"). Takes any of the

Re: t character in regular expression

2012-10-25 Thread Andy Bach
"tr/ACEGIBDFHJ/0246813579/". For sed devotees, "y" is provided as a synonym for "tr". If the SEARCHLIST is delimited by bracketing quotes, the REPLACEMENTLIST has its own pair of quotes, which may or may not be bracketing q

Re: t character in regular expression

2012-10-25 Thread Lawrence Statton
On 10/25/2012 03:57 PM, Weidner, Ron wrote: In the following regex what is the "t" character doing? $linebuf =~ tr/\n/:/; There is no regexp - there is a tr operator perldoc perlop tr/SEARCHLIST/REPLACEMENTLIST/cds y/SEARCHLIST/REPLACEMENTLIST/cds Transliterates all occurrences of t

t character in regular expression

2012-10-25 Thread Weidner, Ron
In the following regex what is the "t" character doing? $linebuf =~ tr/\n/:/; -- Ron ** This e-mail is intended solely for the intended recipient or recipients. If this e-mail is addressed to you in error or you othe

Re: regular expression help

2012-09-21 Thread Octavian Rasnita
From: "Dr.Ruud" On 2012-09-20 09:08, Octavian Rasnita wrote: my ( $file_name ) = $data =~ /([^\\]+)$/g; No need for that g-modifier. -- Ruud Yes, you are right. I added it by mistake. Octavian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

Re: regular expression help

2012-09-20 Thread Dr.Ruud
On 2012-09-20 09:08, Octavian Rasnita wrote: my ( $file_name ) = $data =~ /([^\\]+)$/g; No need for that g-modifier. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regular expression help

2012-09-20 Thread Irfan Sayed
thanks a lot for all the responses :) regards From: Shlomi Fish To: Michael Brader Cc: beginners@perl.org Sent: Thursday, September 20, 2012 2:53 PM Subject: Re: regular expression help On Thu, 20 Sep 2012 17:13:07 +0930 Michael Brader wrote: > A m

Re: regular expression help

2012-09-20 Thread Shlomi Fish
On Thu, 20 Sep 2012 17:13:07 +0930 Michael Brader wrote: > A more idiomatic way to do this is to use the File::Spec module. > Inspect the output of this program for inspiration: > There's also File::Basename: http://perldoc.perl.org/File/Basename.html Regards, Shlomi Fish -- --

Re: regular expression help

2012-09-20 Thread Michael Brader
On 09/20/2012 04:39 PM, Irfan Sayed wrote: got it myself :) thanks a lot $line_to_add =~ m/([a-zA-Z]+\.csproj)/; Hi Irfan, Your solution will only match files that consist of ASCII alphabetic characters followed by '.csproj'. It will also match these: * 'c:\p4\car\abc\foo.csproj\file.tx

Re: regular expression help

2012-09-20 Thread Irfan Sayed
got it myself :) thanks a lot  $line_to_add =~ m/([a-zA-Z]+\.csproj)/; regards From: Irfan Sayed To: Perl Beginners Sent: Thursday, September 20, 2012 12:07 PM Subject: regular expression help i have string 'c:\p4\car\abc\xyz.csproj' i ju

Re: regular expression help

2012-09-20 Thread Octavian Rasnita
g; print $file_name; It will print: xyz.csproj ( and ) captures the matched string but because in this case they capture the whole regular expression, you can omit using them like: my ( $file_name ) = $data =~ /[^\\]+$/g; [^\\] means that it matches everything which is not a \ char, and be

regular expression help

2012-09-19 Thread Irfan Sayed
i have string 'c:\p4\car\abc\xyz.csproj' i just need to match the xyz.csproj i tried few option but does not help. can someone please suggest regards irfan

Re: Unexpected token error when providing a regular expression as input

2012-08-01 Thread Robert Wohlfarth
quot;(.es.){3}" before running Perl. Those extra slashes you added tell "bash" to not interpret the parenthesis. You could also get around the problem by quoting the regular expression on the command line, like this: # ./grep.pl '(.es.){3}' /usr/share/dict/words Hope that helps. -- Robert Wohlfarth

Unexpected token error when providing a regular expression as input

2012-08-01 Thread moijes12
Hi My program takes is supposed to take regular expression and a file containing a list of words/lines as input and print all those lines that match the regular expression. Below is the program #!/usr/bin/perl use strict; use warnings; sub grep_file { my $pattern = shift; my

Re: help in regular expression

2011-09-11 Thread timothy adigun
>> "ug" == Uri Guttman writes: ug> unpack would be a poor choice if the number of digits in a field ug> changes. pack/unpack are meant for use in fixed field records. That was a bad assumption on my side, I only considered the problem at hand, thinking unpack will be faster that subst

Re: help in regular expression

2011-09-10 Thread Uri Guttman
> "ta" == timothy adigun <2teezp...@gmail.com> writes: ta> You can use unpack: ta>$val = "11.0.56.1"; ta>$new_val=unpack("x5 A2",$val); # skip forward 6, get 2 ta> print $new_val # print 56; unpack would be a poor choice if the number of digits in a field changes. pac

Re: help in regular expression

2011-09-10 Thread timothy adigun
Hi Irfan, You can use unpack: $val = "11.0.56.1"; $new_val=unpack("x5 A2",$val); # skip forward 6, get 2 print $new_val # print 56;

Re: help in regular expression

2011-09-10 Thread Rob Dixon
On 10/09/2011 18:23, Irfan Sayed wrote: hi, i have following string. $val = "11.0.56.1"; i need to write regular expression which should match only "56" and print please suggest I think you should forget about regular expressions and use split: my $sub = (split

Re: help in regular expression

2011-09-10 Thread Shawn H Corey
On 11-09-10 01:23 PM, Irfan Sayed wrote: i have following string. $val = "11.0.56.1"; i need to write regular expression which should match only "56" and print please suggest ( $val =~ /(56)/ ) && print $1; -- Just my 0.0002 million dollars worth, S

Re: help in regular expression

2011-09-10 Thread Shlomi Fish
Hi Irfan, On Sat, 10 Sep 2011 10:23:31 -0700 (PDT) Irfan Sayed wrote: > hi, > > i have following string. > > $val = "11.0.56.1"; > > i need to write regular expression which should match only "56" and print > There are any number of way

help in regular expression

2011-09-10 Thread Irfan Sayed
hi, i have following string. $val = "11.0.56.1"; i need to write regular expression which should match only "56" and print please suggest  regards irfan

Re: Regular Expression change

2011-07-20 Thread Rob Dixon
On 15/07/2011 16:42, David Wagner wrote: I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon in the data. So what I have is a

Re: Regular Expression change

2011-07-17 Thread Dr.Ruud
On 2011-07-15 17:42, Wagner, David --- Sr Programmer Analyst --- CFS wrote: I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon

Regular Expression change

2011-07-16 Thread Wagner, David --- Sr Programmer Analyst --- CFS
I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon in the data. So what I have is a pre-defined data separator that would not nor

Re: Regular Expression help!

2011-05-11 Thread jet speed
Hi All, Thanks for your time and valuable inputs, Appreciate it. I will try your suggestions and test it in my program. Sj

Re: Regular Expression help!

2011-05-11 Thread C.DeRykus
On May 11, 8:38 am, speedj...@googlemail.com (jet speed) wrote: > Hi All, > > I need help in matching the regular expression, the file is as below. > > I am trying to match number followed by Number ex 587, 128 in $1 and > 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $

Re: Regular Expression help!

2011-05-11 Thread Rob Dixon
On 11/05/2011 16:38, jet speed wrote: > Hi All, > > I need help in matching the regular expression, the file is as below. > > I am trying to match number followed by Number ex 587, 128 in $1 and > 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 > > the $1 match

Re: Regular Expression help!

2011-05-11 Thread Shawn H Corey
On 11-05-11 11:38 AM, jet speed wrote: I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find with regulare expression #if

Re: Regular Expression help!

2011-05-11 Thread Leo Susanto
:D5:C2:BA:D9:DE:11 763 wwn is 60:06:01:60:50:40:21:00:25:C6:3F:A7:CA:2D:DF:11 On Wed, May 11, 2011 at 8:38 AM, jet speed wrote: > Hi All, > > I need help in matching the regular expression, the file is as below. > > I am trying to match number followed by Number ex 587, 128 in $1 an

Regular Expression help!

2011-05-11 Thread jet speed
Hi All, I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find with regulare expression #if ($_=~ /\w{7}\s\w{4}\s\w{6}\s(\d{1,4})/i

Re: Help regular expression - string paring

2011-05-05 Thread Rob Dixon
21st and 22nd byte value. In the above examples, they are both 05. Could anybody tell me how to retrieve that value out of the strings using regular expression? Thanks in advance! First of all, it would be far better to open whatever is being dumped here and evaluate the fifth byte directly

Re: Help regular expression - string paring

2011-05-05 Thread Owen
the the 21st and 22nd byte value. In the above > examples, they are both 05. > > Could anybody tell me how to retrieve that value out of the strings > using regular expression? > > Thanks in advance! substr #!/usr/bin/perl use strict; while () { my $substring20 = substr( $_,

Re: Help regular expression - string paring

2011-05-05 Thread Jeff Pang
2011/5/4 loudking : > Hi there, > > Hereby I have a string parsing problem to ask. The sample strings look > like this: > > : CC02 0565 8E93 D501 0100 6273 .eb > : 6800 0500 9093 D501 0100 1400 h... > > What I am interested is the the 21st

Help regular expression - string paring

2011-05-05 Thread loudking
examples, they are both 05. Could anybody tell me how to retrieve that value out of the strings using regular expression? Thanks in advance! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regular expression

2011-04-28 Thread Uri Guttman
> "KK" == Karl Kaufman writes: KK> Well, to be precise, your conceptual logic was fine; the KK> implementation was flawed. As several have pointed out, you KK> weren't replacing the comma with a _space_ *character*, but with KK> the RegExp _whitespace_ *character class*. to be really

Re: regular expression

2011-04-28 Thread Karl Kaufman
- Original Message - From: "Irfan Sayed" To: "John W. Krahn" ; "Perl Beginners" Sent: Thursday, April 28, 2011 9:28 AM Subject: Re: regular expression my logic was to just put the space character in place of comma and keep rest as it is but un

Re: regular expression

2011-04-28 Thread Irfan Sayed
thanks all From: Shawn H Corey To: beginners@perl.org Sent: Thursday, April 28, 2011 7:55 PM Subject: Re: regular expression On 11-04-28 10:05 AM, Irfan Sayed wrote: > hi, > > i have following code. > > > $target = "abc,xyz"; &g

Re: regular expression

2011-04-28 Thread Irfan Sayed
: Re: regular expression Irfan Sayed wrote: > hi, Hello, > i have following code. > > > $target = "abc,xyz"; > print "$target\n"; > $target =~ s/,/\s/g; > print "$target\n"; > > i need to replace "comma" with whitespace for st

Re: regular expression

2011-04-28 Thread Shawn H Corey
On 11-04-28 10:05 AM, Irfan Sayed wrote: hi, i have following code. $target = "abc,xyz"; print "$target\n"; $target =~ s/,/\s/g; print "$target\n"; i need to replace "comma" with whitespace for string "abc,xyz" the output shud be "a

Re: regular expression

2011-04-28 Thread John W. Krahn
hing that applies only to regular expressions but the second part of the substitution operator is just a string, not a regular expression. And which of the five whitespace characters should this string interpolate "\s" as: " ", "\r", "n", "t" or &qu

Re: regular expression

2011-04-28 Thread John W. Krahn
applies only to regular expressions but the second part of the substitution operator is just a string, not a regular expression. And which of the five whitespace characters should this string interpolate "\s" as: " ", "\r", "n", "t" or "\f&

regular expression

2011-04-28 Thread Irfan Sayed
hi, i have following code. $target = "abc,xyz"; print "$target\n"; $target =~ s/,/\s/g; print "$target\n"; i need to replace "comma" with whitespace for string "abc,xyz" the output shud be "abc xyz" the above regular expression does not do that . please suggest --irfan

Re: Regular expression help !!

2011-04-27 Thread jet speed
Excellent Guys, I would like thank each one of you for inputs. Much appreciated. i got blinded by just the numbers 0079, i didn't cater for the next line which is hex 007A, as one of you rightly pointed out [ 0-9A-Z] , does the trick. its amazing to see different technique to achieve the same res

Re: Regular expression help !!

2011-04-27 Thread Dr.Ruud
On 2011-04-27 18:47, Jim Gibson wrote: The metasymbol \d matches the characters [0-9], Beware: the \d matches 250+ code points. So don't use \d if you only mean [0-9]. not the extended hexadecimal set that includes A-Z. To match those, construct your own character class: [0-9A-Z] Or us

Re: Regular expression help !!

2011-04-27 Thread Brian Fraser
On Wed, Apr 27, 2011 at 2:48 PM, Shawn H Corey wrote: > On 11-04-27 12:47 PM, Jim Gibson wrote: > >> The metasymbol \d matches the characters [0-9], not the extended >> hexadecimal >> set that includes A-Z. To match those, construct your own character class: >> >> [0-9A-Z] >> > > You can use the

Re: Regular expression help !!

2011-04-27 Thread Shawn H Corey
On 11-04-27 12:47 PM, Jim Gibson wrote: The metasymbol \d matches the characters [0-9], not the extended hexadecimal set that includes A-Z. To match those, construct your own character class: [0-9A-Z] You can use the POSIX xdigit character class instead: #!/usr/bin/env perl use strict; use w

Re: Regular expression help !!

2011-04-27 Thread Paul Johnson
On Wed, Apr 27, 2011 at 04:32:57PM +0100, jet speed wrote: > Hi all, > > Thanks for all our inputs, > > The regular expression below works fine if do it for single line, i am > trying to caputre the match $1, and $2 into array. only the first line > is pushed to the array.

Re: Regular expression help !!

2011-04-27 Thread Jim Gibson
On 4/27/11 Wed Apr 27, 2011 8:32 AM, "jet speed" scribbled: > Hi all, > > Thanks for all our inputs, > > The regular expression below works fine if do it for single line, i am > trying to caputre the match $1, and $2 into array. only the first line > is pushe

Re: Regular expression help !!

2011-04-27 Thread jet speed
Hi all, Thanks for all our inputs, The regular expression below works fine if do it for single line, i am trying to caputre the match $1, and $2 into array. only the first line is pushed to the array. what am i doing wrong ? how to get all the $1 and $2 match values for each line into arrary

Re: Regular expression help !!

2011-04-27 Thread Rob Dixon
On 27/04/2011 11:47, jet speed wrote: Please could you advice, how can i write a regular expression for the line below to capture 0079 and 69729260057253303030373 0079 Not Visible 69729260057253303030373 i tried this one, no luck /(^\d{4})\s\w+\s\w+\s+\d+/ig

  1   2   3   4   5   6   7   8   9   10   >