Re: Regular Expression Help.

2015-03-25 Thread Frank Vino
Thanks a lot Simon -Frank On Wed, Mar 25, 2015 at 5:44 PM, Simon Reinhardt wrote: > Hi Frank, > > when first learning regexps I read the section "In the World of Regular > Expressions" in the Lama-Book [1]. If you find this introduction to > slow, you might also take a look at chromatic's Moder

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 periods, question marks, and asterisks

Re: Regular Expression Help.

2015-03-25 Thread Simon Reinhardt
Hi Frank, when first learning regexps I read the section "In the World of Regular Expressions" in the Lama-Book [1]. If you find this introduction to slow, you might also take a look at chromatic's Modern Perl, which is available for free [2]. Regards, Simon Am 25

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*: I originated pe

Re: Regular Expression Help.

2015-03-24 Thread Rahul Gojame
Frank, Just go through below site, it helps to build regex and test same easily. http://www.regexr.com/ ~Rahul On Wed, Mar 25, 2015 at 10:42 AM, Akshay Mohit wrote: > 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

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: 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 expression, i have the sample cod

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 fc3/23, in my code it print

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 it prints both > the > lines f

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 fc3/23, in my code it

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 entries from the array

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 mat

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
From: "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 my $data = 'c:\p4\car\abc\xyz.csproj'; my ( $file_name ) = $data =~ /([^\\]+)$/g; print $file_name; It will p

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: 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 $2 > > the $1 match works

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 works find with regulare exp

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 ($_=~ /\w

Re: Regular Expression help!

2011-05-11 Thread Leo Susanto
I ended up confused after reading your email. Please specify INPUT + OUTPUT/condition. You have already specify INPUT which is: LOGICAL UNIT NUMBER 587 UID:60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 LOGICAL UNIT NUMBER 128 UID:60:06:01:60:50:4

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: 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. what am i doing wrong ?

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 pushed to the array. what am i doing wr

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 ? Ki

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) It

Re: Regular expression help !!

2011-04-27 Thread Jeff Pang
2011/4/27 jet speed : > Hi, > > Please could you advice, how can i write a regular expression for the > line below to capture 0079 and 69729260057253303030373 > > > 0079 Not Visible             69729260057253303030373 > This might help? $ perl -le ' $str="0079 Not Visible

Re: Regular expression help !!

2011-04-27 Thread Shawn H Corey
On 11-04-27 06:47 AM, jet speed wrote: 0079 Not Visible 69729260057253303030373 Try this: #!/usr/bin/env perl use strict; use warnings; my $text = '0079 Not Visible 69729260057253303030373'; my @numbers = $text =~ /(\d+)/g; print "@numbers\n"; __END_

Re: Regular expression help !!

2011-04-27 Thread Paolo Gianrossi
2011/4/27 jet speed > Hi, > > 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) >

Regular expression help !!

2011-04-27 Thread jet speed
Hi, 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) Appreciate your help with this. Sj -

AW: Regular expression help

2009-09-10 Thread Tariq Doukkali
[mailto:d.t...@imb.uq.edu.au] Gesendet: Mittwoch, 26. August 2009 08:23 An: beginners@perl.org Betreff: Regular expression help Dear list, I am trying to import entries in a csv file into a relational database, however there are entries such as: a,b,c,d,e,"f1,f2","g1,g2" wh

Re: Regular expression help

2009-08-26 Thread Chas. Owens
On Wed, Aug 26, 2009 at 03:46, Dave Tang wrote: snip >> for my $token ($line =~ /([,"]|[^,"]+)/g) { > > I changed the single pipe (|) to double pipes (||) and $token also contained > empty strings. Could you explain the difference between the pipes? snip The pipe character in regexes creates an al

Re: Regular expression help

2009-08-26 Thread Dave Tang
On Wed, 26 Aug 2009 16:41:39 +1000, Chas. Owens wrote: On Wed, Aug 26, 2009 at 02:23, Dave Tang wrote: Dear list, I am trying to import entries in a csv file into a relational database, however there are entries such as: a,b,c,d,e,"f1,f2","g1,g2" which spoil my split(/,/). snip Sounds li

Re: Regular expression help

2009-08-25 Thread Chas. Owens
On Wed, Aug 26, 2009 at 02:23, Dave Tang wrote: > Dear list, > > I am trying to import entries in a csv file into a relational database, > however there are entries such as: > > a,b,c,d,e,"f1,f2","g1,g2" which spoil my split(/,/). snip Sounds like a job for [Text::CSV][1]. Of course, you an alway

Re: Regular expression help

2009-08-25 Thread Uri Guttman
> "DT" == Dave Tang writes: DT> a,b,c,d,e,"f1,f2","g1,g2" which spoil my split(/,/). DT> Could someone provide some guidance? use a CSV module. parsing csv files is a pain with regexes (even if doable). there are very stable and fast csv modules on cpan so get one and use it. uri --

Regular expression help

2009-08-25 Thread Dave Tang
Dear list, I am trying to import entries in a csv file into a relational database, however there are entries such as: a,b,c,d,e,"f1,f2","g1,g2" which spoil my split(/,/). The quotes group f1 and f2 as a single entry. I know each each database entry should be atomic, but I'll deal with that

Re: regular expression help

2009-06-17 Thread John W. Krahn
Irfan Sayed wrote: Hi All, Hello, need help on regular expression. i have string like this "ProductName" = "8:EXFO RTU System 1.2.42" now i want regular expression in such a way that it will change the line to : "ProductName" = "8:EXFO RTU System 1.2.43" $ perl -le' $_ = q["ProductNa

regular expression help

2009-06-17 Thread Ajay Kumar
e it by old value from the line It works For all Thanks Ajay -Original Message- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, June 17, 2009 5:15 PM To: beginners@perl.org Subject: Re: regular expression help it is not just 1.2.43 it may be anything it may be like

Re: regular expression help

2009-06-17 Thread Irfan Sayed
it is not just 1.2.43 it may be anything it may be like 2.3.56 or 2.0.12 and so on... plz advice From: Ajay Kumar To: Irfan Sayed Cc: "beginners@perl.org" Sent: Wednesday, June 17, 2009 5:01:41 PM Subject: RE: regular expression help Hi Irfan

RE: regular expression help

2009-06-17 Thread Ajay Kumar
to:irfan_sayed2...@yahoo.com] Sent: Wednesday, June 17, 2009 4:10 PM To: beginners@perl.org Subject: regular expression help Hi All, need help on regular expression. i have string like this "ProductName" = "8:EXFO RTU System 1.2.42" now i want regular expression in such a wa

regular expression help

2009-06-17 Thread Irfan Sayed
Hi All, need help on regular expression. i have string like this  "ProductName" = "8:EXFO RTU System 1.2.42"   now i want regular expression in such a way that it will change the line to :  "ProductName" = "8:EXFO RTU System 1.2.43"   i tried in the following way.     $_ =~ s/:(.*)\s(.*)\s(.*)\

Re: Regular Expression Help

2008-04-16 Thread Rob Dixon
Ley, Chung wrote: > Hi, > > > > I have a program that will take in a string that will resolve to a path > where the output is going to store. > > > > The path can includes "variables" in this format "%%". > The acceptable variableNames that the program will support are fixed to > a list suc

Re: Regular Expression Help

2008-04-15 Thread John W. Krahn
Ley, Chung wrote: Hi, Hello, I have a program that will take in a string that will resolve to a path where the output is going to store. The path can includes "variables" in this format "%%". The acceptable variableNames that the program will support are fixed to a list such as "Person", "Cl

RE: Regular Expression Help

2008-04-15 Thread Ley, Chung
Thank you! This looks much cleaner. From: Jialin Li [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 15, 2008 8:56 PM To: Ley, Chung Cc: beginners@perl.org Subject: Re: Regular Expression Help my $input =q(C:\Windows\%Person%\%Class%); my @vars

Re: Regular Expression Help

2008-04-15 Thread Jialin Li
my $input =q(C:\Windows\%Person%\%Class%); my @vars = $input =~ /%([^%]+)%/g; local $, = $/; print @vars; On Tue, Apr 15, 2008 at 10:20 PM, Ley, Chung <[EMAIL PROTECTED]> wrote: > Hi, > > > > I have a program that will take in a string that will resolve to a path > where the output is going

Regular Expression Help

2008-04-15 Thread Ley, Chung
Hi, I have a program that will take in a string that will resolve to a path where the output is going to store. The path can includes "variables" in this format "%%". The acceptable variableNames that the program will support are fixed to a list such as "Person", "Class", "Dept". This list

Re: Regular Expression Help

2006-11-01 Thread Ashish Srivastava
Thank You John and Anshul for response. It was great help. Regards, Ashish Srivastava - Original Message From: Anshul Saxena <[EMAIL PROTECTED]> To: John W. Krahn <[EMAIL PROTECTED]> Cc: Perl Beginners Sent: Wednesday, 1 November, 2006 11:01:38 PM Subject: Re: Regula

Re: Regular Expression Help

2006-11-01 Thread Anshul Saxena
Ashish , you might have the [ in a recurring sequence using [* On 11/1/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Ashish Srivastava wrote: > I have a string which have multiple placeholder, for example: > > $str = 'Hello [[Name]], Your login id is [[Login]] !!!"; > > I want to replace all pl

Re: Regular Expression Help

2006-11-01 Thread John W. Krahn
Ashish Srivastava wrote: > I have a string which have multiple placeholder, for example: > > $str = 'Hello [[Name]], Your login id is [[Login]] !!!"; > > I want to replace all placeholder with some identifier. In above example: > identifier are Name and Login. > The regular expression for this

Regular Expression Help

2006-11-01 Thread Ashish Srivastava
I have a string which have multiple placeholder, for example: $str = 'Hello [[Name]], Your login id is [[Login]] !!!"; I want to replace all placeholder with some identifier. In above example: identifier are Name and Login. The regular expression for this requirment is pretty staightward: $st

Re: regular expression help

2006-07-24 Thread Jonathan Weber
On 24 Jul 2006, at 5:48 PM, Rob Dixon wrote: - The character wildcard '.' is just a dot within a character class, so [.\n] will match only a dot or a newline Ah, I hadn't realized that characters in [ ] are literals. That clears up a lot of the problem. - Regexes aren't the best way of p

Re: regular expression help

2006-07-24 Thread Dr.Ruud
"Jonathan Weber" schreef: > A Title > > I'm using a regular expression to find these and capture the name > attribute ("w12234" in the example) and the contents of the h2 tag ("A > Title"). > > $_ =~ /\s*<\/a>\s*(+)<\/h2>/ > > That's my regex, except I'm having trouble with the _ part. N

Re: regular expression help

2006-07-24 Thread Rob Dixon
Jonathan Weber wrote: > > Hi. I have some HTML files with lines like the following: > > A Title > > I'm using a regular expression to find these and capture the name > attribute ("w12234" in the example) and the contents of the h2 tag ("A > Title"). > > $_ =~ /\s*<\/a>\s*(+)<\/h2>/ > > That'

regular expression help

2006-07-24 Thread Jonathan Weber
Hi. I have some HTML files with lines like the following: A Title I'm using a regular expression to find these and capture the name attribute ("w12234" in the example) and the contents of the h2 tag ("A Title"). $_ =~ /\s*<\/a>\s*(+)<\/h2>/ That's my regex, except I'm having trouble with

Re: Regular expression help

2005-04-25 Thread Jay Savage
On 4/25/05, John W. Krahn <[EMAIL PROTECTED]> wrote: > Owen wrote: > > I found a message from Randal Schwartz, Message-ID: > > <[EMAIL PROTECTED]>#1/1 > > which gave a regular expression for a valid Unix name, > > > > /^(?=.*?\D)[a-z\d]+$/ > > > > That works but why does it work? > > > >

Re: Regular expression help

2005-04-24 Thread John W. Krahn
Owen wrote: I found a message from Randal Schwartz, Message-ID: <[EMAIL PROTECTED]>#1/1 which gave a regular expression for a valid Unix name, /^(?=.*?\D)[a-z\d]+$/ That works but why does it work? / ^ # Start of a string (?= # 0 or 1 instance of .*? # anything but a newl

RE: Regular expression help

2005-04-24 Thread Charles K. Clarkson
Owen wrote: : I found a message from Randal Schwartz, Message-ID: : <[EMAIL PROTECTED]>#1/1 : which gave a regular expression for a valid Unix name, : : /^(?=.*?\D)[a-z\d]+$/ : : That works but why does it work? : : / : ^ # Start of a string :(?=

Regular expression help

2005-04-24 Thread Owen
I found a message from Randal Schwartz, Message-ID: <[EMAIL PROTECTED]>#1/1 which gave a regular expression for a valid Unix name, /^(?=.*?\D)[a-z\d]+$/ That works but why does it work? / ^ # Start of a string (?=# 0 or 1 instance of

Re: regular expression help

2005-03-11 Thread Ing. Branislav Gerzo
Stone [S], on Friday, March 11, 2005 at 01:52 (-0800) made these points: S> Just one. :) S> Your expressions all say \d instead of \d? for the second digit in S> each set, while the simple one correctly has \d?. So your S> expressions had an unfair advantage and as a result finish faster. righ

Re: regular expression help

2005-03-11 Thread Stone
> I hope I don't have any bugs here :) Just one. :) Your expressions all say \d instead of \d? for the second digit in each set, while the simple one correctly has \d?. So your expressions had an unfair advantage and as a result finish faster. Add \d? to your expressions, and you should find

Re: regular expression help

2005-03-11 Thread Ing. Branislav Gerzo
Stone [S], on Thursday, March 10, 2005 at 16:46 (-0800) typed: S> That won't work either. When you say ([1-9]\d?) you're telling it S> "(If there is a match) capture the stuff in parentheses and store it." S> When you say "\1" you're telling the script "you know that first S> batch of stuff you

Re: regular expression help

2005-03-10 Thread Stone
> $field =~ /^(?:([1-9]\d?)\.){2}\1$/; That won't work either. When you say ([1-9]\d?) you're telling it "(If there is a match) capture the stuff in parentheses and store it." When you say "\1" you're telling the script "you know that first batch of stuff you captured? Well I want that here."

Re: regular expression help

2005-03-10 Thread Ing. Branislav Gerzo
Stone [S], on Thursday, March 10, 2005 at 12:51 (-0800) wrote the following: >> yes, and for complexity: >> >> $field =~ /^([1-9]\d?)\.{2}\1$/; S> I know you said that's untested, but I don't think it's correct. yes, I'm sorry for that, should be this correct: $field =~ /^(?:([1-9]\d?)\.){2}\1

Re: regular expression help

2005-03-10 Thread Stone
> yes, and for complexity: > > $field =~ /^([1-9]\d?)\.{2}\1$/; I know you said that's untested, but I don't think it's correct. You're saying: 1. ^ - Start 2. ([1-9]\d?) -Any character 1-9 followed by zero or one digit characters. 3. \.{2} - Two periods. 4. \1 - The same sequence of charact

Re: regular expression help

2005-03-10 Thread Ing. Branislav Gerzo
Peter Rabbitson [PR], on Thursday, March 10, 2005 at 14:00 (-0500) wrote: PR> I think what he really wants is to throw a fit when there is a leading zero PR> for which your solution won't cut it. Here is how I see it: PR> $field =~ /^[1-9]\d?\.[1-9]\d?\.[1-9]\d?$/ yes, and for complexity: $fiel

RE: regular expression help

2005-03-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Peter Rabbitson wrote: >> Simplest is change the {2} to {1,2} for all your entries. Now you >> mush have from 1 to 2 digits. Wags ;) > > > I think what he really wants is to throw a fit when there is a > leading zero for which your solution won't cut it. Here is how I see > it: > > $field =~ /^

Re: regular expression help

2005-03-10 Thread Peter Rabbitson
> Simplest is change the {2} to {1,2} for all your entries. Now you > mush have from 1 to 2 digits. > Wags ;) I think what he really wants is to throw a fit when there is a leading zero for which your solution won't cut it. Here is how I see it: $field =~ /^[1-9]\d?\.[1-9]\d?\.[1-9]\d?$/ --

RE: regular expression help

2005-03-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
CM Analyst wrote: > I am quite new to programming and Perl, so please bear > with me. > > I have a requirement to check the format of a field > before a record can be saved. The format of the field > needs to be double digit value separated by a . > (period) like "00.00.00". This I managed to do u

regular expression help

2005-03-10 Thread CM Analyst
I am quite new to programming and Perl, so please bear with me. I have a requirement to check the format of a field before a record can be saved. The format of the field needs to be double digit value separated by a . (period) like "00.00.00". This I managed to do using the following: use strict;

Re: Regular expression help

2004-10-22 Thread Gunnar Hjalmarsson
Bee wrote: I'd do a little add on for the string, so it much easier for split. # usuw; my $line = "M:356 358 386 R:#132 W1:319 NRT:32 R:#132"; print $line . "\n"; $line =~ s/(\s)(\w{1,}:)/\x00$2/g; # So I add extra delimiters here. print $line . "\n"; my @d = split /\x00/, $line; print "<$_> " for

Re: Regular expression help

2004-10-22 Thread Bee
> __DATA__ > M:356 358 386 R:#132 W1:319 NRT:32 R:#132 > > > but I would really like it to capture the first part of the element so that the result would be; > > M:356 358 386 R:#132 W1:319 NRT:32 R:#132 > $y[0] > $y[1] M 356 358 386 > $y[2] R #132 > $y[3] W1 319 > $y[4] NRT 32 > $y[5] R #132 >

Regular expression help

2004-10-21 Thread Owen
This program #!/usr/bin/perl -w use strict; while () { chomp; my $line = $_; my @y =split (/\b[\w]+:/,$line); #print scalar(@y); print $line; print "\n\$y[0] $y[0]\n\$y[1] $y[1]\n\$y[2] $y[2]\n\$y[3] $y[3]\n\$y[4] $y[4]\n\$y[5] $y[5]\n"; } __DATA__ M:356 358 386 R:#132 W1:319 NRT:32 R:#1

regular expression- help

2004-06-18 Thread jack jack
Hi All, I have 2 variables $last_accessed and $owner_line $last_accessed=": Last accessed 20-Apr-04.12:57:30 by [EMAIL PROTECTED]"; $owner_line="Owner: opc_bld : rwx (all)"; -From $last_accessed i want the foll output in variables : $view_day=20 $view_month=Apr $view_year=04 -From

RE: Regular expression help

2003-08-19 Thread EUROSPACE SZARINDAR
to:[EMAIL PROTECTED] Date: lundi 18 août 2003 17:34 À: [EMAIL PROTECTED] Objet: Re: Regular expression help > >"Eurospace Szarindar" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >Thanks you, it works fine. Could you explain me why have you added the

Re: Regular expression help

2003-08-18 Thread Rob Anderson
> >"Eurospace Szarindar" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >Thanks you, it works fine. Could you explain me why have you added the \1 ? Hi, A quick breakdown... /(['"])(((''|"")|[^'"])*?)\1(\s|$)/g ^^ 1 2

RE: Regular expression help

2003-08-18 Thread EUROSPACE SZARINDAR
Thanks you, it works fine. Could you explain me why have you added the \1 ? I will have a look at Text::CSV Michel -Message d'origine- De: Rob Anderson [mailto:[EMAIL PROTECTED] Date: lundi 18 août 2003 16:39 À: [EMAIL PROTECTED] Objet: Re: Regular expression help "

Re: Regular expression help

2003-08-18 Thread Rob Anderson
"Eurospace Szarindar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I tried to write a script to extrat data from the given DATA but I can find > the right regular expression to do that. Hi Szarindar, Firstly why are you using this format and trying to parse it yourself?

Regular expression help

2003-08-18 Thread EUROSPACE SZARINDAR
Hi, I tried to write a script to extrat data from the given DATA but I can find the right regular expression to do that. RULE: I need to catch everything between quotes (single or double) and if inside exists a repeated quote (single or double) it is not seen as end of the match. #!/usr/bin/perl

RE: Regular Expression help

2002-09-24 Thread Mark Anderson
see my comments at bottom... -Original Message- From: Shaun Bramley [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 4:39 PM To: [EMAIL PROTECTED] Subject: Regular Expression help Hi all. I am hoping that someone can help me determine what is wronf with my regualr

RE: Regular Expression help

2002-09-24 Thread nkuipers
>if($array[$x] =~ /\d{1,3}?/) >{ >...do something >} > >Unfortunately this if statement never appears to come true. That's because you have two quantifiers specified, the {1,3} and the ?. for (@array) { if ( m/^\d+$/ ) { #regex breaks on decimal numbers do something... } } -- To unsubscribe

Regular Expression help

2002-09-24 Thread Shaun Bramley
Hi all. I am hoping that someone can help me determine what is wronf with my regualr expression. background info: @array contains 'text', numbers, INT, or TINYINT. I am trying to identify if the array element is a number. What I have right now is: if($array[$x] =~ /\d{1,3}?/) { do somethi

RE: regular expression help....

2002-09-12 Thread david
David --- Senior Programmer Analyst --- Wgo Wagner wrote: > Your log shows a space between the time and hyphen and hyphen and > Micro. You dont' have that in the regex and even more so, there is no > hyphen before Adapter log. > > You might want: > /^(\d\d-\d\d-\d{4})\s+(\d\d:\d\d:\d\d\.\d\d).+A

RE: regular expression help....

2002-09-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
ed)/i Anchor with the ^ and you will have date in $1, time in $2 and opened or closed in $3. A shot. Wags ;) -Original Message- From: Steve [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 08:12 To: [EMAIL PROTECTED] Subject: regular expression help I hav

regular expression help....

2002-09-11 Thread Steve
I have the following line in a log file: 09-07-2002 11:39:25.95 - Microsoft Dial Up Adapter log opened. The date and time will always change but the after that it's always consistent (well opened will sometimes be closed) I need to get the entire date in a variable and the entire time in a va

Re: Regular Expression Help sought

2002-07-04 Thread Katy Brownfield
> also detect the beginning of the string. > > > > $file =~ s/((^|\n\n).+?)\n/$1 /g; > > > > Katy > > > > Timothy Johnson wrote: > > > > > > > > > I think you'll need 2 blank lines. > > > > > > -Original M

Re: Regular Expression Help sought

2002-07-04 Thread Nigel Peck
ohnson wrote: > > > > > > I think you'll need 2 blank lines. > > > > -Original Message- > > From: Sunish Kapoor > > To: Nigel Peck > > Cc: [EMAIL PROTECTED] > > Sent: 7/3/02 6:51 PM > > Subject: Re: Regular Expression Help sough

Re: Regular Expression Help sought

2002-07-03 Thread Sunish Kapoor
nish Kapoor > > To: Nigel Peck > > Cc: [EMAIL PROTECTED] > > Sent: 7/3/02 6:51 PM > > Subject: Re: Regular Expression Help sought > > > > Dear Nigel, > > > > Thanks a ton for the script..It works fine though it skips the first > > record > &g

Re: Regular Expression Help sought

2002-07-03 Thread Katy Brownfield
r > To: Nigel Peck > Cc: [EMAIL PROTECTED] > Sent: 7/3/02 6:51 PM > Subject: Re: Regular Expression Help sought > > Dear Nigel, > > Thanks a ton for the script..It works fine though it skips the first > record > even though I make > the file begin with a blank

RE: Regular Expression Help sought

2002-07-03 Thread Timothy Johnson
I think you'll need 2 blank lines. -Original Message- From: Sunish Kapoor To: Nigel Peck Cc: [EMAIL PROTECTED] Sent: 7/3/02 6:51 PM Subject: Re: Regular Expression Help sought Dear Nigel, Thanks a ton for the script..It works fine though it skips the first record even though I

Re: Regular Expression Help sought

2002-07-03 Thread Sunish Kapoor
Dear Nigel, Thanks a ton for the script..It works fine though it skips the first record even though I make the file begin with a blank line by simply hitting enter ! Regards Sunish Nigel Peck wrote: > My first attempt, which may be a bit simplified, would be to substitute > any newline, which

  1   2   >