Reg Exp after newline

2012-01-22 Thread Lívio Cipriano
Hi, It's possible to build in Perl a Regular Expression to grab a pattern that extends by two lines ? I want to read a file and know if it's a email message or not, fetching the first Message-Id found. The problem is that some email clients put the Message-Id tag in one line, like this

Re: Reg Exp after newline

2012-01-22 Thread John W. Krahn
Lívio Cipriano wrote: Hi, Hello, It's possible to build in Perl a Regular Expression to grab a pattern that extends by two lines ? Yes it is. I want to read a file and know if it's a email message or not, fetching the first Message-Id found. The problem is that some email clients put the

Re: reg exp

2011-05-31 Thread Chris Nehren
On Wed, May 25, 2011 at 07:39:28 -0700 , Irfan Sayed wrote: hi, i have string like this 2011/05/25 07:24:58 -0700 PDT  i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~

reg exp

2011-05-25 Thread Irfan Sayed
hi, i have string like this 2011/05/25 07:24:58 -0700 PDT  i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/; print $lin\n; plz suggest

RE: reg exp

2011-05-25 Thread Marco van Kammen
consider the environment before printing this email-Original Message- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, May 25, 2011 4:39 PM To: Perl Beginners Subject: reg exp hi, i have string like this 2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25 i wrote

Re: reg exp

2011-05-25 Thread Irfan Sayed
thanks it worked From: Marco van Kammen mvankam...@mirabeau.nl To: Irfan Sayed irfan_sayed2...@yahoo.com; Perl Beginners beginners@perl.org Sent: Wednesday, May 25, 2011 8:22 PM Subject: RE: reg exp Surely not perfect but this seems to work... $lin = 2011/05

Re: reg exp

2011-05-25 Thread Jim Gibson
At 7:39 AM -0700 5/25/11, Irfan Sayed wrote: hi, i have string like this 2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~

Re: reg exp

2011-05-25 Thread Shawn H Corey
On 11-05-25 10:39 AM, Irfan Sayed wrote: hi, i have string like this 2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/; print

Re: reg exp

2011-05-25 Thread Rob Dixon
On 25/05/2011 15:39, Irfan Sayed wrote: hi, i have string like this 2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~

Re: reg exp

2011-05-25 Thread Abhinav Kukreja
hi, suppose i have a string that contains n number of date patterns in the string. 2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45 how can i extract all such patterns. On Wed, May 25, 2011 at 10:08 PM, Rob Dixon rob.di...@gmx.com wrote: On 25/05/2011 15:39, Irfan Sayed

Re: reg exp

2011-05-25 Thread Jim Gibson
At 8:11 AM +0530 5/26/11, Abhinav Kukreja wrote: hi, suppose i have a string that contains n number of date patterns in the string. 2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45 how can i extract all such patterns. Use a regular expression that matches just those

Re: reg exp

2011-05-25 Thread Dr.Ruud
On 2011-05-25 16:39, Irfan Sayed wrote: i have string like this 2011/05/25 07:24:58 -0700 PDT i need to match 2011/05/25 i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = 2011/05/25 07:24:58 -0700 PDT; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/; print

Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread HolyNoob
Hi, I'm trying to make a regexp to match the last appearance of a word (lets say 'abc') until the first appearance of another word (for ex: 'xyz'), and I still cannot do it. For example: with a string like this abc abc abc toto toto xyz xyz xyz , which regexp I have to use to get abc toto toto

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread Erez Schatz
You need to specify that the string you look for should not appear in the part you try to extract, meaning instead of .*? you should be looking for (not abc)*? In perl, we have the negative lookahed for that: (?!...): m/abc((.(?!abc))*?)xyz/ However, this would fail if you have a string abc

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread Erez Schatz
All this and more is available at http://perldoc.perl.org/perlre.html On 27 April 2010 12:39, Erez Schatz moonb...@gmail.com wrote: You need to specify that the string you look for should not appear in the part you try to extract, meaning instead of .*? you should be looking for (not abc)*? In

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread John W. Krahn
HolyNoob wrote: Hi, Hello, I'm trying to make a regexp to match the last appearance of a word (lets say 'abc') until the first appearance of another word (for ex: 'xyz'), and I still cannot do it. For example: with a string like this abc abc abc toto toto xyz xyz xyz , which regexp I have

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread HolyNoob
Thanks everyone, The solution of John W. Krahn works perfectly :) Incredible On Tue, Apr 27, 2010 at 1:41 PM, John W. Krahn jwkr...@shaw.ca wrote: HolyNoob wrote: Hi, Hello, I'm trying to make a regexp to match the last appearance of a word (lets say 'abc') until the first

reg exp question

2009-07-15 Thread Lex Thoonen
Hi, I'm trying to do this: in the original text is this: ((se-HomePage|Svenska)) I want to leave it at just: Svenska So I tried this: $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; but somehow after substituting it now shows: ((se-HomePage|Svenska I don't get it. Someone here? Thanks! -- Lex

Re: reg exp question

2009-07-15 Thread Steve Bertrand
Lex Thoonen wrote: Hi, I'm trying to do this: in the original text is this: ((se-HomePage|Svenska)) I want to leave it at just: Svenska So I tried this: $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; but somehow after substituting it now shows: ((se-HomePage|Svenska I don't

Re: reg exp question

2009-07-15 Thread John W. Krahn
Lex Thoonen wrote: Hi, I'm trying to do this: in the original text is this: ((se-HomePage|Svenska)) I want to leave it at just: Svenska So I tried this: $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; but somehow after substituting it now shows: ((se-HomePage|Svenska I don't get it. $ perl

Re: perl reg. exp. (search and replace)

2008-11-03 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all, Hello, I have a string which contains spaces. I need to replace those spaces with underscore, so I have written command like this $string=fsdfsdfsdf fsdfsdfsdf; chomp($string1 = ($string =~ s/\s+$/_/g)); \s+$ matches one or more of any whitespace

Re: perl reg. exp. (search and replace)

2008-11-03 Thread Anirban Adhikary
use strict; use warnings; my $string=fsdfsdfsdf fsdfsdfsdf; my ($a,$b)=split(/\s+/,$string); my $new_string=$a._.$b; print $new_string.\n; Regards Anirban Adhikary. On Mon, Nov 3, 2008 at 2:15 PM, John W. Krahn [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi all, Hello, I have a

perl reg. exp. (search and replace)

2008-11-02 Thread Irfan.Sayed
Hi all, I have a string which contains spaces. I need to replace those spaces with underscore, so I have written command like this $string=fsdfsdfsdf fsdfsdfsdf; chomp($string1 = ($string =~ s/\s+$/_/g)); print $string1\n; but still $string1 is not printing proper result. Result should

Re: Regarding reg. exp.

2008-10-14 Thread Rob Dixon
be in the following format. For example:- 1,2,3 OR 1 2 3 Which means that delimiter between these figures should be comma OR space. No any other character. I need all users to adhere that and if they not then they should exit. Can somebody please give me reg. exp. which can be used

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
But I don’t want to match 12,2, or 234432 53. I want to match whether string contains 1 2 OR 1,2 OR 1,2,3 OR 1 2 3 Or any such combinations. And I think this reg. exp. is doing that job. -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
Thanks really -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 6:31 PM To: Perl Beginners Cc: Sayed, Irfan (Cognizant) Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] wrote: From: Rob Dixon [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED

Re: Regarding reg. exp.

2008-10-14 Thread Vyacheslav Karamov
[EMAIL PROTECTED] пишет: if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) this what I did. Hi! Why have you used {1} quantifier? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regarding reg. exp.

2008-10-14 Thread Rob Dixon
Dr.Ruud wrote: Rob Dixon schreef: my $re = qr/^ \d+ (?: (?:,\d+)* | (?: \d+)* ) $/x; chomp (my $input = ); if ($input =~ $re) { print ok\n; } else { print invalid\n; } One problem: the space in (?: \d+)* is eaten by the x-modifier. I would normally use

Re: Regarding reg. exp.

2008-10-14 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) As long as you understand that \s matches SPC, TAB, CR, NL and several other characters, and \d matches [0-9] and many other characters, and how one day that will bite you, feel free to use \s and \d. (I would use neither \s nor

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
Because I want comma (,) exactly once -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 4:41 PM To: Sayed, Irfan (Cognizant) Cc: [EMAIL PROTECTED]; beginners@perl.org Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] пишет

Re: Regarding reg. exp.

2008-10-14 Thread Vyacheslav Karamov
[EMAIL PROTECTED] пишет: Because I want comma (,) exactly once -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 4:41 PM To: Sayed, Irfan (Cognizant) Cc: [EMAIL PROTECTED]; beginners@perl.org Subject: Re: Regarding reg. exp. [EMAIL

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) this what I did. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Monday, October 13, 2008 6:49 PM To: Perl Beginners Cc: Sayed, Irfan (Cognizant) Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] wrote: I have a string and I

Re: Regarding reg. exp.

2008-10-13 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: For example:- 1,2,3 OR 1 2 3 I assume it should also work on 132,45,16 but should it also work on 132, 45, 16 or on 0132,-45,16E0,0x03 etc. ? See Regexp::Common. -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL

Re: Regarding reg. exp.

2008-10-13 Thread Rob Dixon
Which means that delimiter between these figures should be comma OR space. No any other character. I need all users to adhere that and if they not then they should exit. Can somebody please give me reg. exp. which can be used to parse the string and check whether comma OR space

Re: Regarding reg. exp.

2008-10-13 Thread Rob Coops
format. For example:- 1,2,3 OR 1 2 3 Which means that delimiter between these figures should be comma OR space. No any other character. I need all users to adhere that and if they not then they should exit. Can somebody please give me reg. exp. which can be used to parse the string

Re: Regarding reg. exp.

2008-10-13 Thread Dr.Ruud
Rob Dixon schreef: my $re = qr/^ \d+ (?: (?:,\d+)* | (?: \d+)* ) $/x; chomp (my $input = ); if ($input =~ $re) { print ok\n; } else { print invalid\n; } One problem: the space in (?: \d+)* is eaten by the x-modifier. I would normally use [[:blank:]], but in this case

Regarding reg. exp.

2008-10-13 Thread Irfan.Sayed
that delimiter between these figures should be comma OR space. No any other character. I need all users to adhere that and if they not then they should exit. Can somebody please give me reg. exp. which can be used to parse the string and check whether comma OR space is there or not as a delimiter

help in reg. exp.

2008-04-21 Thread Irfan.Sayed
Hi All, I have string like OMS.FD.08.03.000.0 Now my req. is that if the string contains .0 at the end then I want to remove that .0 but if any other digit is there other than .0 then don't do anything. For example: if string is : OMS.FD.08.03.000.0 then regular expression should give

Re: help in reg. exp.

2008-04-21 Thread Chas. Owens
On Mon, Apr 21, 2008 at 7:17 AM, [EMAIL PROTECTED] wrote: snip I have string like OMS.FD.08.03.000.0 Now my req. is that if the string contains .0 at the end then I want to remove that .0 but if any other digit is there other than .0 then don't do anything. snip What have you tried so far?

Re: help in reg. exp.

2008-04-21 Thread J. Peng
On Mon, Apr 21, 2008 at 7:17 PM, [EMAIL PROTECTED] wrote: Hi All, I have string like OMS.FD.08.03.000.0 Now my req. is that if the string contains .0 at the end then I want to remove that .0 but if any other digit is there other than .0 then don't do anything. For example: if

Re: help in reg. exp.

2008-04-21 Thread Rob Dixon
[EMAIL PROTECTED] wrote: I have string like OMS.FD.08.03.000.0 Now my req. is that if the string contains .0 at the end then I want to remove that .0 but if any other digit is there other than .0 then don't do anything. For example: if string is : OMS.FD.08.03.000.0 then regular expression

how to write 0 to 10 in reg exp.

2008-04-02 Thread itshardtogetone
Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print Yes match\n; }else{print no};

Re: how to write 0 to 10 in reg exp.

2008-04-02 Thread Jeff Pang
try this one: # perl -Mstrict -le 'my $x=shift; print 1 if $x=~/^[0-9]$|^10$/' 10 1 On 4/2/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks

RE: how to write 0 to 10 in reg exp.

2008-04-02 Thread sanket vaidya
PROTECTED] Sent: Wednesday, April 02, 2008 2:09 PM To: beginners@perl.org Subject: how to write 0 to 10 in reg exp. Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
D. Bolliger [EMAIL PROTECTED] wrote:oryann9 am Montag, 18. Dezember 2006 19:52: D. Bolliger wrote: [snipped] How are my quesitons unclear??? [snipped] I answered offlist. Sorry to all for the noise of this notice. Dani

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
Anyway. When you print $dub_values and it shows up as an array ref as ARRAY(0x4002c164) and you want the values of this arrayref, you have to dereference it in some way. Start with printing out @$dub_values. Or assign it before if you want bigger freedom to format the values: my @[EMAIL

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
oryann9 [EMAIL PROTECTED] wrote: Here is my question I have a line of code like so: $dub_key = $dub_values\n; that prints dubhpr28.hpux = ARRAY(0x4002e1bc) but I want to have printed out the values contained in the $dub_values arrayref instead of its address. What do I have to change

reg exp continued need pulled from reference

2006-12-18 Thread oryann9
Hello... I have thought about this one and tried various code changes but cannot get what I want. My problem: mismatched UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than

Re: reg exp continued need pulled from reference

2006-12-18 Thread D. Bolliger
oryann9 am Montag, 18. Dezember 2006 16:55: Hello... I have thought about this one and tried various code changes but cannot get what I want. My problem: mismatched UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array

Re: reg exp continued need pulled from reference

2006-12-18 Thread oryann9
D. Bolliger [EMAIL PROTECTED] wrote: I guess the reason why you got no answer when you posted the identical question in a recent thread is because, at least - your question(s) is/are unclear - your code is not trimmed - even not from comments Anyway. When you print $dub_values and it shows

Re: reg exp continued need pulled from reference

2006-12-18 Thread D. Bolliger
oryann9 am Montag, 18. Dezember 2006 19:52: D. Bolliger [EMAIL PROTECTED] wrote: [snipped] How are my quesitons unclear??? [snipped] I answered offlist. Sorry to all for the noise of this notice. Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
Dr.Ruud [EMAIL PROTECTED] wrote:Lawrence Statton XE2/N1GAK schreef: @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud Gewoon is een tijger. -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
oryann9 [EMAIL PROTECTED] wrote: Dr.Ruud wrote: Lawrence Statton XE2/N1GAK schreef: @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud Gewoon is een tijger. -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
oryann9 [EMAIL PROTECTED] wrote:oryann9 [EMAIL PROTECTED] wrote: Dr.Ruud wrote: Lawrence Statton XE2/N1GAK schreef: @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud Gewoon is een tijger. -- Ok everyone, I have thought about this one and tried various code

Re: reg exp continued need pulled from reference

2006-12-14 Thread Lawrence Statton XE2/N1GAK
Ahh, good catch -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] wrote: If you're dealing with variable length strings, separated by some kind of character, then regexp is the tool you want, not substr. This snippet will work so long as hostname and platform name are made up of \w ... if not, substitute

RE: reg exp continued need pulled from reference

2006-12-13 Thread Charles K. Clarkson
Derek B. Smith mailto:[EMAIL PROTECTED] wrote: : I then tried Try something simpler, not more complex. Test this case. my @hosts = ( 'sun' ); $worksheet-write_col( 'A2', [EMAIL PROTECTED], $sheet_format ); If it fails testing then there may be a problem with write_col() or with the

Re: reg exp continued need pulled from reference

2006-12-13 Thread Lawrence Statton XE2/N1GAK
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] I am using Spreadsheet::WriteExcel to populate certain columns which is working, but in column A for example I am using the method write_col which requires a reference, Not just a reference but an ARRAY reference for all the values that will

Re: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] wrote: --- Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] I am using Spreadsheet::WriteExcel to populate certain columns which is working, but in column A for example I am using the method write_col which requires a reference, Not

RE: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- Charles K. Clarkson [EMAIL PROTECTED] wrote: Derek B. Smith mailto:[EMAIL PROTECTED] wrote: : I then tried Try something simpler, not more complex. Test this case. my @hosts = ( 'sun' ); $worksheet-write_col( 'A2', [EMAIL PROTECTED], $sheet_format ); If it fails

reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
I want to extend any apologies necessary for my last post. I am not a violent person its just I get annoyed when some people are negative, or to me, are condescending. I was not mad just upset and bothered. No biggy and the past is in the past. : ) -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: reg exp continued need pulled from reference

2006-12-13 Thread Dr.Ruud
Lawrence Statton XE2/N1GAK schreef: @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

reg exp

2006-12-12 Thread Derek B. Smith
I have a string like so: /home/dbsmith/passwd.oftappp1.hpux and I need to parse out oftappp1 and hpux. I have tried to use substr and and regexp with =~. Here is what I have tried, but need some help cause I am getting frustrated. NOTE: strings after passwd are variable in length, could be 3-10

Re: reg exp

2006-12-12 Thread D. Bolliger
Derek B. Smith am Dienstag, 12. Dezember 2006 23:19: I have a string like so: /home/dbsmith/passwd.oftappp1.hpux and I need to parse out oftappp1 and hpux. I have tried to use substr and and regexp with =~. Here is what I have tried, but need some help cause I am getting frustrated.

Re: reg exp

2006-12-12 Thread John W. Krahn
Derek B. Smith wrote: I have a string like so: /home/dbsmith/passwd.oftappp1.hpux and I need to parse out oftappp1 and hpux. I have tried to use substr and and regexp with =~. Here is what I have tried, but need some help cause I am getting frustrated. NOTE: strings after passwd are

Re: reg exp

2006-12-12 Thread Lawrence Statton XE2/N1GAK
If you're dealing with variable length strings, separated by some kind of character, then regexp is the tool you want, not substr. This snippet will work so long as hostname and platformname are made up of \w ... if not, substitute in an appropriate character class. #!/usr/bin/perl use strict;

Re: reg exp

2006-12-12 Thread I . B .
or just: my $filename=/home/dbsmith/passwd.duby02.linux; my ($pass,$hostname,$platform)=split /\./, $filename; ~i On 12/12/06, Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] wrote: If you're dealing with variable length strings, separated by some kind of character, then regexp is the tool you

Re: reg exp

2006-12-12 Thread Derek B. Smith
--- D. Bolliger [EMAIL PROTECTED] wrote: Derek B. Smith am Dienstag, 12. Dezember 2006 23:19: I have a string like so: /home/dbsmith/passwd.oftappp1.hpux and I need to parse out oftappp1 and hpux. I have tried to use substr and and regexp with =~. Here is what I have tried, but

Re: reg exp speed?

2006-05-21 Thread Alan Campbell
line by line processing...but I'm losing it in my (likely poorly constructed!) reg-expression match I do: - # # look for potentially problematic code of the following form: - # STW b0, *SP--[3] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc

Re: reg exp speed?

2006-05-21 Thread Dr.Ruud
Alan Campbell schreef: Please don't top-post. # look for potentially problematic dissassembly of the following form: - # 8004b980 003c34f4 STW.D2T1 A0,*B15--[1] my @dis_lines = ; foreach my $ln (@dis_lines) { if ($ln =~ m/.*ST[A-Z].*B15--.*[13579]]/) {

Re: reg exp speed?

2006-05-21 Thread John W. Krahn
Alan Campbell wrote: hello folks, Hello, Thanks for all the advice. As several of you suggested, the winning ticket turned out to be flipping to line-by-line regex from an array-slurped input i.e. # look for potentially problematic dissassembly of the following form: - # 8004b980

Re: reg exp speed?

2006-05-20 Thread John W. Krahn
: - # STW b0, *SP--[3] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by # the string 'B15--' followed by # anything

reg exp speed?

2006-05-19 Thread Alan Campbell
] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by # the string 'B15--' followed by # anything up until

RE: reg exp speed?

2006-05-19 Thread Timothy Johnson
or not, but it's something to check. -Original Message- From: Alan Campbell [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 3:13 PM To: beginners@perl.org Subject: reg exp speed? hello folks, I'm slurping in a large file and seeing a nice speedup versus line by line processing

Re: reg exp speed?

2006-05-19 Thread David Romano
of the following form: - # STW b0, *SP--[3] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by # the string 'B15

Re: reg exp speed?

2006-05-19 Thread Dr.Ruud
] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by # the string 'B15--' followed by # anything up

Re: 'medium' reg exp greediness?

2006-04-30 Thread Alan Campbell
. I'm open to using a module but pure reg exp (non line-by-line) seems faster...and speed is important in this case due to filesize. Grateful for any ideas u may have. Cheers, Alan Jay Savage [EMAIL PROTECTED] wrote: On 4/29/06, Alan Campbell wrote: hello folks, I'm trying to do

'medium' reg exp greediness?

2006-04-29 Thread Alan Campbell
/die which is too muchkills stuff I need to keep. But .*? is too lazy...it doesnt handle the nesting ie only kills up until the first /die. To further complicate life, I cant guarentee the level of nesting. Any ideas on how best to reg exp this? Or do I just need to improve/narrow

Re: 'medium' reg exp greediness?

2006-04-29 Thread Jay Savage
On 4/29/06, Alan Campbell [EMAIL PROTECTED] wrote: hello folks, I'm trying to do a 'medium' greediness regular expression. Here's what I mean. I need to grab all of the DW_TAG_TI_reserved stuff and kill it (italics below) die id='0x157'

reg exp help

2006-04-27 Thread sandy
-- Hi, The content of file hello.c is as given below. I want to count how many + and - are there in this file. I had equivalent shel command to count no. of + and -, grep -e ^+[^+] diffs.txt | wc -l grep -e ^-[^-] diffs.txt | wc -l Can anyone help me how to write perl script using

Re: reg exp help

2006-04-27 Thread Jay Savage
On 4/27/06, sandy [EMAIL PROTECTED] wrote: Hi, The content of file hello.c is as given below. I want to count how many + and - are there in this file. I had equivalent shel command to count no. of + and -, grep -e ^+[^+] diffs.txt | wc -l grep -e ^-[^-] diffs.txt | wc -l You say two

strange result with reg exp

2005-09-14 Thread Christopher Spears
In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like Occ, then the expression will convert it to OC instead of OCC! What is going on? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

RE: strange result with reg exp

2005-09-14 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Christopher Spears wrote: In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like Occ, then the expression will convert it to OC instead of OCC! What is going on? the /s says to squash ( Programming Perl )

Re: strange result with reg exp

2005-09-14 Thread John W. Krahn
Christopher Spears wrote: In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like Occ, then the expression will convert it to OC instead of OCC! What is going on? tr/// does NOT use regular expressions, it

Re: strange result with reg exp

2005-09-14 Thread Jeff 'japhy' Pinyan
On Sep 14, Christopher Spears said: In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like Occ, then the expression will convert it to OC instead of OCC! What is going on? It sounds like you're using an operator you

Re: reg exp using \G

2005-08-03 Thread DBSMITH
Please respond to Subject Jay Savage Re: reg exp using \G [EMAIL PROTECTED

reg exp using \G

2005-08-02 Thread DBSMITH
All, I think I am on the right track as far as what assertion to use. I need to print from one string to another using .. with \G My goal is to capture from allsets down. thank you Here is my code: #!/usr/bin/perl use strict; use warnings; $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin); open

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I think I am on the right track as far as what assertion to use. I need to print from one string to another using .. with \G Why do you want to use \G? My goal is to capture from allsets down. Here is my code: #!/usr/bin/perl use

Re: reg exp using \G

2005-08-02 Thread DBSMITH
Subject Re: reg exp using \G Please respond to Dave Gray

Re: reg exp using \G

2005-08-02 Thread John Doe
[EMAIL PROTECTED] am Dienstag, 2. August 2005 19.36: reg exp using \G Datum: 2.8.05  19:36:44 Von: [EMAIL PROTECTED] An: beginners@perl.org All, I think I am on the right track as far as what assertion to use.  I need to print from one string to another using .. with \G Your boss

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: technically you are correct about escaping the dot, but in this particular situation my regexp is working. I will escape the dot. my goal again is to print from one sting to another from allsets down. I apologize for the long output

Re: reg exp using \G

2005-08-02 Thread DBSMITH
Subject Re: reg exp using \G Please respond to Dave Gray

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: yes but the problem is my start point and end point have identical entries under them. It is stopping at original1.1 when I need for it to stop at the end of original1.1 and print media: sf Volumes: STK000 Total space available:

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, Dave Gray [EMAIL PROTECTED] wrote: On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: yes but the problem is my start point and end point have identical entries under them. It is stopping at original1.1 when I need for it to stop at the end of original1.1 and print media:

Re: reg exp using \G

2005-08-02 Thread Jay Savage
Please don't top post. I think you've been asked this before. On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ok I understand now...thanks, but I tried it and it is still stopping at original1.1 I then modified it to print YE if ($1) but never saw YE in STDOUT. Tha's because

reg exp help

2005-06-28 Thread DBSMITH
Can anyone help me with this match: #!/usr/bin/perl use strict; use warnings; my $talxkeylog =qq(/home/gpghrp/.gnupg/keys/log/talxkeyupd.log); open (FH, +$talxkeylog) or warn unable to open file $talxkeylog $! ; #cURL(); #print $calcdate\n$curtdate; my

Re: reg exp help

2005-06-28 Thread bright true
Hello, First of all you're opening the file for writing Second i didn't understand what you really want , if you want to print out everything inside the file my $file = 'newfile.txt'; open(FILE,$file); while(FILE){ print $_;} close(FILE); That's it with out matching or anything bye

Re: reg exp help

2005-06-28 Thread DBSMITH
respond to Re: reg exp help bright true [EMAIL PROTECTED] .com

Re: reg exp help

2005-06-28 Thread Jay Savage
On 6/28/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Can anyone help me with this match: [snip] for (;FH;) { if (/^-{5,}(\w+)/ig) { print $_; }

Re: reg exp help

2005-06-28 Thread Jeff 'japhy' Pinyan
On Jun 28, [EMAIL PROTECTED] said: for (;FH;) { if (/^-{5,}(\w+)/ig) { print $_; } $lc++; } I want to print everything from BEGIN TO END and right now all I am printing is the begin and end lines. If that's what you want, you should use two regexes with the .. operator: while

  1   2   3   >