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

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

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

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

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

Regular Expression Help

2001-10-19 Thread Gross, Stephan
I'm matching a SQL date like this: $ftime =~ /(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/; If $ftime is "2001-05-13 11:53:00", then $1 is "2001", $2 is "05", etc. However, I also want to match if the user types in a partial string. For example, if $ftime is "2001-12-18", I want $1, $2 and $3 to

Regular expression help!!

2001-10-25 Thread Woz
Hi, I'm relatively new to the wonders of Perl programming and I've yet to quite get my head around regular expressions. I'm attempting to generate a search and replace expression that will turn the following string insert_job: DUKS_rtcf_daily_log_purge job_type: c into DUKS_rtcf

regular expression help

2002-01-22 Thread David Samuelsson (PAC)
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? //Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional co

Regular Expression Help

2002-02-05 Thread David Mamanakis
I am building a parsing routine, and am using a regular expression, which works, EXCEPT when I need to EXCLUDE certain things... i.e. $right =~ s/A/X/g; Basically, replacing A with X in the $right... However, I may need to exclude this replacement in some of the values of $right... i.e. Anythi

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(.*)\

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

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

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 -

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)

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

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

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

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;

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

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

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

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

Regular Expression Help sought

2002-07-03 Thread Sunish Kapoor
Hi All, I am new to Perl and need help to solve this one ! I have a txt file and the contents of the file are as below : ---CONTENTS OF TEXT FILE-- Abdullah Ahmed Hassan Trading Location Ruwi Souk St, Ruwi Bus Hrs 0930-1300:1630-2200 P.O. Box 197 Ruwi

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

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

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 h

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 ju

RE: regular expression help

2002-01-22 Thread marcus_holland-moritz
PROTECTED]] | Sent: Tuesday, January 22, 2002 10:37 AM | To: '[EMAIL PROTECTED]' | Subject: regular expression help | | | 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:

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

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

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

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 ju

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:

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

  1   2   >