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 >

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....

2002-09-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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).+Adapter log\s+(opened|closed)/i

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

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 expressio

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?

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] > >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-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

2001-10-19 Thread Randal L. Schwartz
> "Stephan" == Stephan Gross <[EMAIL PROTECTED]> writes: Stephan> I'm matching a SQL date like this: Stephan>$ftime =~ /(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/; Stephan> If $ftime is "2001-05-13 11:53:00", then $1 is "2001", $2 is "05", etc. Stephan> However, I also want to match if th

RE: Regular expression help!!

2001-10-25 Thread Robert Graham
Hi You can try the following: $line = "insert_job: DUKS_rtcf_daily_log_purge job_type: c"; ($rest) = $line =~ m/(\W\w.*)/; Regards Robert -Original Message- From: Woz [mailto:[EMAIL PROTECTED]] Sent: 25 October 2001 11:17 To: [EMAIL PROTECTED] Subject: Regular expression help!! Hi,

RE: Regular expression help!!

2001-10-25 Thread Woz
Thu 25/10/2001 10:27 To: Woz; [EMAIL PROTECTED] Cc: Subject: RE: Regular expression help!! Hi You can try the following: $line = "insert_job: DUKS_rtcf_daily_log_purge job_type: c"; ($rest) = $line =~ m/(\

RE: Regular expression help!!

2001-10-25 Thread Robert Graham
: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Regular expression help!! Wow, that was fast! Thanks very much, that works well. For my next question (:-)) how can I make it strip the leading space that it leaves on the resulting string. i.e. I want it to strip 'insert_job: ' from

Re: Regular expression help!!

2001-10-25 Thread Jeff 'japhy' Pinyan
On Oct 25, Woz said: >turn the following string > >insert_job: DUKS_rtcf_daily_log_purge job_type: c > >into > >DUKS_rtcf_daily_log_purge job_type: c > >i.e. remove from the beginning of the line up the space following the >first : You're probably trying s/.*: //; which is matching greed

RE: Regular expression help!!

2001-10-25 Thread Woz
: Woz; [EMAIL PROTECTED] Cc: Subject: RE: Regular expression help!! You can use the following to remove the space in front $Value =~ /s/^\s+//; And for the sake of interest $Value =~ s/\s+$//; will remove any trailing spaces

RE: Regular expression help!!

2001-10-28 Thread Veeraraju_Mareddi
D]; [EMAIL PROTECTED] Subject: RE: Regular expression help!! Wow, that was fast! Thanks very much, that works well. For my next question (:-)) how can I make it strip the leading space that it leaves on the resulting string. i.e. I want i

RE: regular expression help

2002-01-22 Thread John Edwards
Escape the brackets like so. s/\(locked\)//; John -Original Message- From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]] Sent: 22 January 2002 09:37 To: '[EMAIL PROTECTED]' Subject: regular expression help Hello! if i have this line ROXETTE_PC_SW_R1D08 (locked) and just want to

RE: regular expression help

2002-01-22 Thread marcus_holland-moritz
Try: s/\s+\(locked\)// The parens are meta-symbols in regexes and need to be escaped if you want to match them. The above will additionally make sure that the blanks before (locked) are also removed. HTH, Marcus | -Original Message- | From: David Samuelsson (PAC) [mailto:[EMAIL PROTE

RE: regular expression help

2002-01-22 Thread Jonathan E. Paton
> | Hello! > | > | If I have this line ROXETTE_PC_SW_R1D08 (locked) > | and just want to remove the (locked) part from it > | with an regexp how would that look? > | > | I can do: s/(locked)// that leaves the pesky () how > | can I get rid off those? > > Try: > > s/\s+\(locked\)// > > The

Re: Regular Expression Help

2002-02-05 Thread Jeff 'japhy' Pinyan
On Feb 5, David Mamanakis said: >I am building a parsing routine, and am using a regular expression, which >works, EXCEPT when I need to EXCLUDE certain things... > >$right =~ s/A/X/g; > >However, I may need to exclude this replacement in some of the values of >$right... > >Anything found between

Re: Regular Expression Help

2002-02-05 Thread John W. Krahn
Jeff 'Japhy' Pinyan wrote: > > On Feb 5, David Mamanakis said: > > > >I am building a parsing routine, and am using a regular expression, which > >works, EXCEPT when I need to EXCLUDE certain things... > > > >$right =~ s/A/X/g; > > > >However, I may need to exclude this replacement in some of the

Re: Regular Expression Help

2002-02-05 Thread Jeff 'japhy' Pinyan
On Feb 5, John W. Krahn said: >Jeff 'Japhy' Pinyan wrote: >> >> $text =~ m{(<.*?>|&.*?;|{\$.*?}|<.*?=)|A}{$1 || "X"}seg; > ^ > ^ > s Sorry, thanks for the correction. :) -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI A

RE: regular expression help

2009-06-17 Thread Ajay Kumar
Hi Irfan This code solve your problem my $p="\"ProductName\" = \"8:EXFO RTU System 1.2.42\""; my ($val)=$p=~ m/\d+.\d+.(\d+)\"/; my $inval=$val+1; $p=~s/$val/$inval/; print"===$p\n"; thanks Ajay -Original Message- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, June

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

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

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-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-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 !!

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

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

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

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

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

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'

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

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

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

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
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 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 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
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
> $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-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-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 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-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 :(?=

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

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

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 just need to matc

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 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 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 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-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.

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 >

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

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

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