Re: Help me with a regex problem

2019-10-26 Thread Dermot
You might consider using Regexp::Common::net. It provides a convenient set of functions for matching IP v4, v6 and mac addresses. https://metacpan.org/pod/Regexp::Common::net On Fri, 25 Oct 2019 at 19:43, John W. Krahn wrote: > On 2019-10-25 3:23 a.m., Maggie Q Roth wrote: > > Hello > > Hell

Re: Help me with a regex problem

2019-10-25 Thread John W. Krahn
On 2019-10-25 3:23 a.m., Maggie Q Roth wrote: Hello Hello. There are two primary types of lines in the log: What are those two types? How do you define them? 60.191.38.xx/ 42.120.161.xx /archives/1005 From my point of view those two lines have two fields, the first loo

Re: Help me with a regex problem

2019-10-25 Thread Andy Bach
/(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ To avoid the "leaning toothpick" problem, Perl lets use different match delimiters, so the above is the same as: m#(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?/.*)# I assume you want to capture the IP and the path, right? if

Re: Help me with a regex problem

2019-10-25 Thread Benjamin S Pendygraft II
That is a backslash followed by a forward slash. The backslash tells the regex parser to treat the next character as a literal character. Useful for matching periods, question marks, brackets, etc. A period matches any character once and an asterisk matches the previous character any number of time

Re: Help me with a regex problem

2019-10-25 Thread X Dungeness
my $n = '[0-9]{1,3}'; if ( =~ ( m[ (?:$n\.){3} $n \s+ \S+ ]x ) { # match } On Fri, Oct 25, 2019 at 3:37 AM Maggie Q Roth wrote: > what's V.*? > > Maggie > > On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote: > >> For example, this regex >> >> /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,

Re: Help me with a regex problem

2019-10-25 Thread Maggie Q Roth
what's V.*? Maggie On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote: > For example, this regex > > /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ > > On 25.10.2019 13:23, Maggie Q Roth wrote: > > Hello > > > > There are two primary types of lines in the log: > > > > 60.191.38.

Re: Help me with a regex problem

2019-10-25 Thread Илья Рассадин
For example, this regex /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ On 25.10.2019 13:23, Maggie Q Roth wrote: Hello There are two primary types of lines in the log: 60.191.38.xx        / 42.120.161.xx       /archives/1005 I know how to write regex to match each line, but do

Help me with a regex problem

2019-10-25 Thread Maggie Q Roth
Hello There are two primary types of lines in the log: 60.191.38.xx/ 42.120.161.xx /archives/1005 I know how to write regex to match each line, but don't get the good result with one regex to match both lines. Can you help? Thanks, Maggie

Re: regex problem?

2015-11-25 Thread Shawn H Corey
On Wed, 25 Nov 2015 17:22:04 + Andrew Solomon wrote: > The only problem I can see is that you want UPPERCASE-1234 and your > regex has lowercase. Try > > (\A[A-Z]+) # match and capture leading alphabetics Please put the anchor outside the capture. And you could use the POSIX conventions:

Re: regex problem?

2015-11-25 Thread Andrew Solomon
The only problem I can see is that you want UPPERCASE-1234 and your regex has lowercase. Try (\A[A-Z]+) # match and capture leading alphabetics Andrew p.s Why not add "use strict; use warnings", "my $var;" and wear a seat belt when you're driving?:) On Wed, Nov 25, 2015 at 5:09 PM, Rick T

Fwd: regex problem?

2015-11-25 Thread Raj Barath
-- Forwarded message -- From: Raj Barath mailto:barat...@outlook.com>> Date: Wed, Nov 25, 2015 at 1:16 PM Subject: Re: regex problem? To: Rick T mailto:p...@reason.net>> Hi Rick, You can use split. For example: my ( $stud_surname, $stud_number ) = split ( /-/,

regex problem?

2015-11-25 Thread Rick T
The following code apparently is not doing what I wanted. My intention was to confirm that the general format of $student_id was this: several uppercase letters followed by a hyphen followed by several digits. If not, it would trigger the die. Unfortunately it seems to always trigger the die. F

Re: A regex problem?

2012-08-13 Thread Andy Bach
On Mon, Aug 13, 2012 at 5:42 AM, Owen wrote: > I have a web form with a text area that I feed back through a cgi > script and "filter" the text with; > > $q1_elaborate =~ s/[^[:alpha:]' .-]//g; > quotemeta($q1_elaborate); > > However, it removes line feeds as well, so maybe that code is not al

A regex problem?

2012-08-13 Thread Owen
I have a web form with a text area that I feed back through a cgi script and "filter" the text with; $q1_elaborate =~ s/[^[:alpha:]' .-]//g; quotemeta($q1_elaborate); I admit to doing a google search on "perl remove malicious code" and took that code from one of the results.(and not quite und

RE: regex problem

2010-11-05 Thread Ken Slater
>From: jm [mailto:jm5...@gmail.com] >Sent: Friday, November 05, 2010 10:21 AM > >i appreciate the tips. unfortunately, adding modules to this server >is not currently possible. does anyone have a more 'hands-on' >solution? Take a look at the Text::ParseWords module. I believe it should be insta

Re: regex problem

2010-11-05 Thread jm
i appreciate the tips. unfortunately, adding modules to this server is not currently possible. does anyone have a more 'hands-on' solution? On Fri, Nov 5, 2010 at 8:53 AM, Shawn H Corey wrote: > On 10-11-05 09:34 AM, jm wrote: >> >> i have csv files in the following format, where some fields a

Re: regex problem

2010-11-05 Thread Robert Wohlfarth
On Fri, Nov 5, 2010 at 8:34 AM, jm wrote: > changing the formatting of the source file to enclose all fields in > double quotes is not an option. i'm trying to figure out a regex, > split, or some other functionality that will allow me to either > > 1. wrap each 'bare' field in double quotes (ig

Re: regex problem

2010-11-05 Thread Shawn H Corey
On 10-11-05 09:34 AM, jm wrote: i have csv files in the following format, where some fields are enclosed in double quotes if they have commas embedded in them and all other fields are simply comma-delimited without any encapsulation The best way to deal with CSV is to use a module from CPAN. T

regex problem

2010-11-05 Thread jm
i have csv files in the following format, where some fields are enclosed in double quotes if they have commas embedded in them and all other fields are simply comma-delimited without any encapsulation, such as some,data,more,data,numbers,etc,"data with a , in the datastream",yet more data,"po

Re: Regex problem

2009-12-26 Thread Chris Charley
- Original Message - From: "Owen" Newsgroups: perl.beginners Hello Owen To check the date passed with a script, I first check that the date is in the format 20dd (20 followed by 6 digits exactly) But the regex is wrong, tried /^20\d{6}/,/^20\d{6,6}?/,/^20\d{6,}?/ and while a

Regex problem

2009-12-26 Thread Owen
To check the date passed with a script, I first check that the date is in the format 20dd (20 followed by 6 digits exactly) But the regex is wrong, tried /^20\d{6}/,/^20\d{6,6}?/,/^20\d{6,}?/ and while a 7 or lesser digit number fails, eg 2009101, a 9 digit number, like 200910103 does not fai

Re: Regex problem

2009-12-21 Thread Robert Wohlfarth
On Mon, Dec 21, 2009 at 9:11 AM, jbl wrote: > The desired output would be > 91416722243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > > while ( defined ( my $line = ) ) { > $line =~ s/(\s)243 /$1243rd /g; > print MY_OUTPUT_FILE $line; > } > T

Re: Regex problem

2009-12-21 Thread Shawn H Corey
jbl wrote: > I have a lengthy list of data that I read in. I have substituted a one > line example using __DATA__. > The desired output would be > 91416722 243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > The capturing reference on (\s)..$1 > > is

Regex problem

2009-12-21 Thread jbl
I have a lengthy list of data that I read in. I have substituted a one line example using __DATA__. The desired output would be 91416722243rd St I am getting this as output 91416722rd St <- just the rd St The capturing reference on (\s)..$1 is not working # Intent # Look for

Re: Regex problem, #.*# on new line

2009-03-11 Thread John W. Krahn
Brent Clark wrote: Hiya Hello, I got a string like so, and for the likes of me I can get regex to have it that each line is starts with #abc#. my $a = "#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;"; $

Re: Regex problem

2009-03-11 Thread Chas. Owens
On Wed, Mar 11, 2009 at 12:53, howa wrote: > Hello, > > On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote: >> That will test if $a starts with 'html' or 'jpg'. To test for a non-match, >> use the !~ operator: >> > > I can't, since I will add more criteria into the regex, > > e.g. > > I

Re: Regex problem

2009-03-11 Thread howa
Hello, On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote: > That will test if $a starts with 'html' or 'jpg'. To test for a non-match, > use the !~ operator: > I can't, since I will add more criteria into the regex, e.g. I need to match a.* , except a.html or a.jpg if ( $a =~ /a\.(

Re: Regex problem

2009-03-11 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:41 PM, "howa" scribbled: > Hi, > > On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: >> >> I would do: >> >>      if ( $a =~ /\.(?:html|jpg)$/i ) >> >> Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate >> docs. > > Read the

Regex problem, #.*# on new line

2009-03-11 Thread Brent Clark
Hiya I got a string like so, and for the likes of me I can get regex to have it that each line is starts with #abc#. my $a = "#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;"; $a =~ s/(?join( "\n", split(/#.*

Re: Regex problem

2009-03-11 Thread howa
Hi, On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: > > I would do: > >      if ( $a =~ /\.(?:html|jpg)$/i ) > > Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate > docs. Read the doc, but how to negate the "Non-capturing groupings" ? use strict; my $a = '

Re: Regex problem

2009-03-10 Thread Gunnar Hjalmarsson
howa wrote: Hello, Consider the code: #=== use strict; my $a = 'a.jpg'; if ($a =~ /(html|jpg)/gi) { print 'ok'; } #=== Is the brucket "()" must be needed? Parentheses. What happened when you tried without them? And why the /g modifier? Since I am n

Re: Regex problem

2009-03-10 Thread Chas. Owens
On Tue, Mar 10, 2009 at 11:19, howa wrote: > Hello, > > Consider the code: > #=== > > use strict; > > my $a = 'a.jpg'; > > if ($a =~ /(html|jpg)/gi) { >    print 'ok'; > } > > #=== > > > Is the brucket "()" must be needed? Since I am not using back > reference, are

Re: Regex problem

2009-03-10 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:19 AM, "howa" scribbled: > Hello, > > Consider the code: > #=== > > use strict; > > my $a = 'a.jpg'; > > if ($a =~ /(html|jpg)/gi) { > print 'ok'; > } > > #=== > > > Is the brucket "()" must be needed? Since I am not using

Regex problem

2009-03-10 Thread howa
Hello, Consider the code: #=== use strict; my $a = 'a.jpg'; if ($a =~ /(html|jpg)/gi) { print 'ok'; } #=== Is the brucket "()" must be needed? Since I am not using back reference, are there a better way? Thanks. -- To unsubscribe, e-mail: beginners-uns

Re: Simple regex problem has me baffled

2009-01-27 Thread Gunnar Hjalmarsson
Bill Harpley wrote: Hi Gunnar, I tried your suggestions but had no luck :-( (1) I tried your idea of using a paragraph separator local $/ = ''; # paragraph mode while ( my $entry = ) { if ( $entry =~ /\[([a-z0-9]{5})]/ ) { print "$1\n";

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
Can you explain why this works but my orginal effort did not? Many thanks, Bill Harpley -Original Message- From: Rob Dixon [mailto:rob.di...@gmx.com] Sent: Monday, January 26, 2009 7:19 PM To: Perl Beginners Cc: Bill Harpley Subject: Re: Simple regex problem has me baffled Bill Harple

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
each record into a single long line before trying to perform regex match? Is there an easy way to do this? Regards, Bill Harpley -Original Message- From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc] Sent: Monday, January 26, 2009 5:22 PM To: beginners@perl.org Subject: Re: Simple re

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
it:]] but to no avail So I remain stuck at square one !! Regards, Bill -Original Message- From: John W. Krahn [mailto:jwkr...@shaw.ca] Sent: Monday, January 26, 2009 5:20 PM To: Perl Beginners Subject: Re: Simple regex problem has me baffled Bill Harpley wrote: > Hello, He

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
uch as 'print "$1\n";' in other scripts. Regards, Bill Harpley -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Monday, January 26, 2009 4:32 PM To: Bill Harpley Cc: beginners@perl.org Subject: Re: Simple regex problem has

Re: Simple regex problem has me baffled

2009-01-26 Thread Rob Dixon
Bill Harpley wrote: > Hello, > > I have simple regex problem that is driving me crazy. > > I am writing a script to analyse a log file. It contains Java related > information about requests and responses. > > Each pair of Request (REQ) and Response (RES) calls have a u

Re: Simple regex problem has me baffled

2009-01-26 Thread Gunnar Hjalmarsson
Bill Harpley wrote: [2009-01-23 09:20:48,719]TRACE [server-1] [http-80-5] a...@mydomain.net :090123-092048567:f5825 (SetCallForwardStatusImpl.java:call:54) - RequestId [81e80] SetCallForwardStatus.REQ { accountNumber:=W12345, phoneNumber:=12121212121, onBusyStatus:=true, busyCurrent:=voicemail,

Re: Simple regex problem has me baffled

2009-01-26 Thread John W. Krahn
Bill Harpley wrote: Hello, Hello, I have simple regex problem that is driving me crazy. I am writing a script to analyse a log file. It contains Java related information about requests and responses. Each pair of Request (REQ) and Response (RES) calls have a unique Request ID. This is a 5

Re: Simple regex problem has me baffled

2009-01-26 Thread Mr. Shawn H. Corey
On Mon, 2009-01-26 at 16:20 +0100, Bill Harpley wrote: > foreach $entry(@list) > { > > $entry =~ /\[([a-z0-9]{5})\]/; > > print "$1\n"; # print to screen > > # print FILE "$1\n";# print to file > } If there is no match, you are printing a uninitiali

Simple regex problem has me baffled

2009-01-26 Thread Bill Harpley
Hello, I have simple regex problem that is driving me crazy. I am writing a script to analyse a log file. It contains Java related information about requests and responses. Each pair of Request (REQ) and Response (RES) calls have a unique Request ID. This is a 5 digit hex number contained in

Re: Regex problem with accented characters

2007-03-27 Thread Rob Dixon
Beginner wrote: /^(\w{2})\s+(\w+\s\w+\s\w+s\w+|\w+\s\w+\s\w+|\w+\s\w+|\w+)/); It's worth noting that this could be written: /^(\w{2})\s+(\w+(?:\s\w+)*)/); Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regex problem with accented characters

2007-03-27 Thread Rob Dixon
Beginner wrote: Hi, I am trying to extract the iso code and country name from a 3 column table (taken from en.wikipedia.org) and have noticed a problem with accented characters such as Ô. Below is my script and a sample of the data I am using. When I run the script the code beginning CI for

Re: Regex problem with accented characters

2007-03-27 Thread Mumia W.
On 03/27/2007 03:34 AM, Beginner wrote: Hi, I am trying to extract the iso code and country name from a 3 column table (taken from en.wikipedia.org) and have noticed a problem with accented characters such as Ô. Below is my script and a sample of the data I am using. When I run the script t

Regex problem with accented characters

2007-03-27 Thread Beginner
Hi, I am trying to extract the iso code and country name from a 3 column table (taken from en.wikipedia.org) and have noticed a problem with accented characters such as Ô. Below is my script and a sample of the data I am using. When I run the script the code beginning CI for Côte d'Ivoire returns

Re: strange regex problem with backslash and newline

2006-08-05 Thread John W. Krahn
Peter Daum wrote: > Hi, Hello, > when trying to process continuation lines in a file, I ran > into a weird phenomenon that I can't make any sense of: > > $s contains a line read from a file, that ends with a backslash > (+ the newline character), so > > $s='abc \ > '; > > $s =~ /^(.*)$/; print

Re: strange regex problem with backslash and newline

2006-08-05 Thread Peter Daum
Tom Phoenix wrote: > On 8/5/06, Peter Daum <[EMAIL PROTECTED]> wrote: >> $s =~ /^(.*[^\\])(\\)?$/; print "1: '$1', 2: '$2'"; > > Let's see what that pattern matches by annotating it: > > m{ >^ # start of string >( # memory 1 > .*# any ol' junk, including backslashes

Re: strange regex problem with backslash and newline

2006-08-05 Thread Tom Phoenix
On 8/5/06, Peter Daum <[EMAIL PROTECTED]> wrote: $s='abc \ '; $s =~ /^(.*[^\\])(\\)?$/; print "1: '$1', 2: '$2'"; Let's see what that pattern matches by annotating it: m{ ^ # start of string ( # memory 1 .*# any ol' junk, including backslashes [^\\] # any n

Re: strange regex problem with backslash and newline

2006-08-05 Thread D. Bolliger
Peter Daum am Samstag, 5. August 2006 18:45: > Hi, Hallo Peter > when trying to process continuation lines in a file, I ran > into a weird phenomenon that I can't make any sense of: > > $s contains a line read from a file, that ends with a backslash > (+ the newline character), so > > $s='abc \ >

strange regex problem with backslash and newline

2006-08-05 Thread Peter Daum
Hi, when trying to process continuation lines in a file, I ran into a weird phenomenon that I can't make any sense of: $s contains a line read from a file, that ends with a backslash (+ the newline character), so $s='abc \ '; $s =~ /^(.*)$/; print $1; # prints "abc \" as expected If the line

Re: XML Parsing error - regex problem?

2006-03-10 Thread Tom Phoenix
On 3/10/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: > I've checked my XML file and it contains: > St. Patrick<92>s R.C. P.S. > > This is because St. Patrick's contains an apostrophe. I'm guessing that where I see four characters "<92>", the actual file has a single character. Some tools render

RE: XML Parsing error - regex problem?

2006-03-10 Thread Graeme McLaren
n" <[EMAIL PROTECTED]> To: beginners@perl.org Subject: XML Parsing error - regex problem? Date: Fri, 10 Mar 2006 10:03:50 + MIME-Version: 1.0 X-Originating-IP: [212.250.155.249] X-Originating-Email: [EMAIL PROTECTED] X-Sender: [EMAIL PROTECTED] Received: from lists.develooper.com ([63

XML Parsing error - regex problem?

2006-03-10 Thread Graeme McLaren
Hi all, I'm getting the following XML parsing error: [Fri Mar 10 09:37:39 2006] insert_xml.pl: not well-formed (invalid token) at line 13628, column 24, byte 413248: [Fri Mar 10 09:37:39 2006] insert_xml.pl: LA14 [Fri Mar 10 09:37:39 2006] insert_xml.pl: 5741726 [Fri Mar 10 09:37:39 2006] inser

Re: regex problem

2006-02-16 Thread Jay Savage
On 2/15/06, anand kumar <[EMAIL PROTECTED]> wrote: > > > "John W. Krahn" <[EMAIL PROTECTED]> wrote:anand kumar wrote: > > Hi all, > > Hello, > > > I have the following problem in the following regex replace. > > > > $line=~s!\b($name)\b!$1!g; > > > > here this regex finds the exact matching of

Re: regex problem

2006-02-15 Thread anand kumar
"John W. Krahn" <[EMAIL PROTECTED]> wrote:anand kumar wrote: > Hi all, Hello, > I have the following problem in the following regex replace. > > $line=~s!\b($name)\b!$1!g; > > here this regex finds the exact matching of the content in $name and does > the needed but in some examples the v

Re: regex problem

2006-02-14 Thread John W. Krahn
anand kumar wrote: > Hi all, Hello, > I have the following problem in the following regex replace. > > $line=~s!\b($name)\b!$1!g; > > here this regex finds the exact matching of the content in $name and does > the needed but in some examples the variable $name may contain backslash > characters

regex problem

2006-02-14 Thread anand kumar
Hi all, I have the following problem in the following regex replace. $line=~s!\b($name)\b!$1!g; here this regex finds the exact matching of the content in $name and does the needed but in some examples the variable $name may contain backslash characters like 'gene\l=s\' , in t

Re: regex problem

2005-07-01 Thread Jay Savage
On 7/1/05, Moon, John <[EMAIL PROTECTED]> wrote: > The following is not returning what I had expected... > > SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/123};print "Yes - $a like > $home\n" if $a =~ /^$home/;' > SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/ra};print "Yes - $a like > $home

Re: regex problem

2005-07-01 Thread Ing. Branislav Gerzo
Moon, John [MJ], on Friday, July 1, 2005 at 11:30 (-0400 ) contributed this to our collective wisdom: MJ> I would have "assumed" that /var/run would NOT be "like" /var/ru just as MJ> /var/run is not "like" /var/ra... is "/var/ru" at the beginning of "/var/run" ? yes. -- ...m8s, cu l8r, Brano

Re: regex problem

2005-07-01 Thread Chris Devers
On Fri, 1 Jul 2005, Moon, John wrote: > The following is not returning what I had expected... > > $a= q{/var/run}; > $home = q{/var/ru}; > print "Yes - $a like $home\n" if $a =~ /^$home/; > > I would have "assumed" that /var/run would NOT be "like" /var/ru just > as /var/run is not "like"

regex problem

2005-07-01 Thread Moon, John
The following is not returning what I had expected... SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/123};print "Yes - $a like $home\n" if $a =~ /^$home/;' SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/ra};print "Yes - $a like $home\n" if $a =~ /^$home/;' SUN1-BATCH>perl -e '$a=q{/var/run}; $

Re: one-liner multi-line regex problem

2005-04-25 Thread Kevin Horton
On 25-Apr-05, at 10:06 AM, Jay Savage wrote: On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote: I'm trying to write a perl one-liner that will edit an iCalendar format file to remove To Do items. The file contains several thousand lines, and I need to remove several multi-line blocks. The blocks

Re: one-liner multi-line regex problem

2005-04-25 Thread Kevin Horton
On 25-Apr-05, at 10:06 AM, Jay Savage wrote: On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote: I'm trying to write a perl one-liner that will edit an iCalendar format file to remove To Do items. The file contains several thousand lines, and I need to remove several multi-line blocks. The blocks

Re: one-liner multi-line regex problem

2005-04-25 Thread Dave Gray
> I'm trying to write a perl one-liner that will edit an iCalendar > format file to remove To Do items. The file contains several > thousand lines, and I need to remove several multi-line blocks. The > blocks to remove start with a line "BEGIN:VTODO" (without the quotes) > and end with a line "EN

Re: one-liner multi-line regex problem

2005-04-25 Thread Jay Savage
On 4/25/05, Kevin Horton <[EMAIL PROTECTED]> wrote: > I'm trying to write a perl one-liner that will edit an iCalendar > format file to remove To Do items. The file contains several > thousand lines, and I need to remove several multi-line blocks. The > blocks to remove start with a line "BEGIN:V

Re: one-liner multi-line regex problem

2005-04-25 Thread John Doe
Hi Kevin just hints, no solution :-) Am Montag, 25. April 2005 12.59 schrieb Kevin Horton: > I'm trying to write a perl one-liner that will edit an iCalendar > format file to remove To Do items. The file contains several > thousand lines, and I need to remove several multi-line blocks. The > bl

one-liner multi-line regex problem

2005-04-25 Thread Kevin Horton
I'm trying to write a perl one-liner that will edit an iCalendar format file to remove To Do items. The file contains several thousand lines, and I need to remove several multi-line blocks. The blocks to remove start with a line "BEGIN:VTODO" (without the quotes) and end with a line "END:VTOD

Re: YA Regex problem: lookahead assertion

2005-03-24 Thread John W. Krahn
Jan Eden wrote: John W. Krahn wrote on 23.03.2005: This should work (untested) while ($content =~ m#(.+?)(.+?)(?=|\z)#gs) { and thanks. I tried Offer Kaye's first guess, too, and I think I can explain why it does not work. If you make the lookahead optional, the regex will try to match as few chara

Re: YA Regex problem: lookahead assertion

2005-03-24 Thread Jan Eden
Offer Kaye wrote on 23.03.2005: >Change your RE to: m#(.+?)(.+?)(?=|$)#gs > >In other words, look ahead to either a or the end of the string >("$"). I have to admit this problem wasn't as simple as I initially >thought - I still have no idea why my first guess didn't work: >m#(.+?)(.+?)(?=)?#gs >

Re: YA Regex problem: lookahead assertion

2005-03-23 Thread John W. Krahn
Jan Eden wrote: Hi, Hello, I use the following regex to split a (really simple) file into sections headed by .+?: while ($content =~ m#(.+?)(.+?)(?=)#gs) { ... } This works perfectly, but obviously does not catch the last section, as it is not followed by . How can I catch the last section wi

RE: YA Regex problem: lookahead assertion

2005-03-23 Thread Charles K. Clarkson
Jan Eden wrote: : Hi, : : I use the following regex to split a (really simple) file into : sections headed by .+?: : : while ($content =~ m#(.+?)(.+?)(?=)#gs) { : ... : } The answer may be in your description. Use 'split'. When you use a capture inside the reg

Re: YA Regex problem: lookahead assertion

2005-03-23 Thread Offer Kaye
On Wed, 23 Mar 2005 17:06:59 +0100, Jan Eden wrote: > Hi, > > I use the following regex to split a (really simple) file into sections > headed by .+?: > > while ($content =~ m#(.+?)(.+?)(?=)#gs) { > ... > } > > This works perfectly, but obviously does not catch the last section, as it is >

YA Regex problem: lookahead assertion

2005-03-23 Thread Jan Eden
Hi, I use the following regex to split a (really simple) file into sections headed by .+?: while ($content =~ m#(.+?)(.+?)(?=)#gs) { ... } This works perfectly, but obviously does not catch the last section, as it is not followed by . How can I catch the last section without * doing a se

Re: A regex problem.

2004-11-09 Thread William C. Bruce
[EMAIL PROTECTED] (Denham Eva) wrote in news:[EMAIL PROTECTED]: > Hello Gurus, > In a script I have a piece of code as such:- > * snip** > my $filedate =~ s/(\d+)//g; > * snip end *** > The data I am parsing looks as such :- > ** DATA >

Re: A regex problem.

2004-09-06 Thread Ing. Branislav Gerzo
Denham Eva [DE], on Monday, September 6, 2004 at 14:41 (+0200) typed: DE> my $filedate =~ s/(\d+)//g; DE> ** DATA DE> C:/directory/MSISExport_20040814.csv DE> C:/directory/MSISExport_20040813.csv DE> Can someone help me with that regex? I am having a frustrating time of I hop

Re: A regex problem.

2004-09-06 Thread Gunnar Hjalmarsson
Jaffer Shaik wrote: Try in this way. Just remove "my", you will get it. What kind of stupid advice is that? $filedate = "C:/directory/MSISExport_20040814.csv"; ($filedate) =~ s/(\_\d+)//g; Left aside that the parentheses are redundant, that does the opposite of what the OP asked for. -- Gunnar Hj

Re: A regex problem.

2004-09-06 Thread Flemming Greve Skovengaard
Denham Eva wrote: Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; Try this instead: my $filedate; if( $var_with_file_name =~ m/(\d+)\.csv$/ ) { $filedate = $1; } print "$filename\n"; * snip end **

RE: A regex problem.

2004-09-06 Thread Jaffer Shaik
September 06, 2004 6:11 PM To: [EMAIL PROTECTED] Subject: A regex problem. Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; * snip end *** The data I am parsing looks as such :- ** D

A regex problem.

2004-09-06 Thread Denham Eva
Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; * snip end *** The data I am parsing looks as such :- ** DATA C:/directory/MSISExport_20040814.csv C:/directory/MSISE

RE: regex problem

2004-08-10 Thread Chris Devers
On Tue, 10 Aug 2004 [EMAIL PROTECTED] wrote: So Data::Dumper shows me a structure of any scaler? Could you show me an example? Data::Dumper is a tool for showing the structure of *any* data. As is often the case, the perldoc has some of the best documentation: perldoc Data::Dumper It starts o

RE: regex problem

2004-08-10 Thread DBSMITH
09/2004 06:31 PM To: <[EMAIL PROTECTED]> cc: <[EMAIL PROTECTED]> Subject:RE: regex problem [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote: : it is a system app call that populates the : $EDM_nonactive_tapelist I am not sure what you m

RE: regex problem

2004-08-09 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : it is a system app call that populates the : $EDM_nonactive_tapelist I am not sure what you mean : "I'm not sure. "has the Orig strings in it" is not a : precise statement for a computer programmer." I meant that "has the Orig strings in

RE: regex problem

2004-08-09 Thread DBSMITH
ings in it ! the foreach with the split did work! thanks! Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams "Charles K. Clarkson" <[EMAIL PROTECTED]> 08/09/2004 05:41 PM To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Subject:

RE: regex problem

2004-08-09 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : All I am getting the error from my if statement: : : ^* matches null string many times in regex; marked by <-- : HERE in m/^* <-- : HERE Orig/ at . : : I am trying to get everything except *Orig in this output : : : *Orig Vol: 1703FBBDED58D4AD (E00

Re: regex problem

2004-08-09 Thread DBSMITH
TECTED]> cc: Subject: Re: regex problem perhaps you meant "^\* ... rather than "\^\* ... the later will trap things beginning with "^*" ... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 09, 20

Re: regex problem

2004-08-09 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: All I am getting the error from my if statement: ^* matches null string many times in regex; marked by <-- HERE in m/^* <-- HERE Orig/ at . I am trying to get everything except *Orig in this output : Here is my code: foreach ($EDM_nonactive_tapelist) { if

regex problem

2004-08-09 Thread DBSMITH
All I am getting the error from my if statement: ^* matches null string many times in regex; marked by <-- HERE in m/^* <-- HERE Orig/ at . I am trying to get everything except *Orig in this output : *Orig Vol: 1703FBBDED58D4AD (E00117), Seq #: 000114 in TLU: st_9840_acs_0, media: STK 984e Or

Re: Yet Another Regex Problem

2004-06-08 Thread Ramprasad A Padmanabhan
CHange your regex to /http(s)*:\/\/.*?\s/ To see the docs perldoc perlre ... look for greedy HTH Ram On Tue, 2004-06-08 at 16:15, Francesco del Vecchio wrote: > Hi guyz, > > this regex are goin' to drive me crazy! > > My problem is: > > I have to find URLs in a text file (so, cannot use LW

Re: Yet Another Regex Problem

2004-06-08 Thread Jeff 'japhy' Pinyan
On Jun 8, Francesco del Vecchio said: >I have to find URLs in a text file (so, cannot use LWP or HTML parser) I'm curious why you can't use a module to extract URLs, but I'll continue anyway. >/(http.:\/\/.*\s)/ That regex is broken in a few ways. First, it does NOT match 'http:', it only matc

Yet Another Regex Problem

2004-06-08 Thread Francesco del Vecchio
Hi guyz, this regex are goin' to drive me crazy! My problem is: I have to find URLs in a text file (so, cannot use LWP or HTML parser) I've tried with something like /(http.:\/\/.*\s)/ willing to find anything starting with http/https with "//:" and catching everything up to a space or newli

regex problem

2004-05-04 Thread Graeme McLaren
Hey all, I need to do a regular expression to match the URL with a return status from an error log which looks like this: title: test 7 size = 78 pick: 10.2.203.1, # servers = 1 8:8:1:http://10.2.203.1/test8.html: Retrieval command for http://10.2.203.1/test8.html: GET /test8.html HTTP/1.0 User-

Re: Substitution/Regex problem

2004-05-02 Thread Cedric Godin
On Thursday 29 April 2004 10:31, Owen wrote: > I would like to replace all instances of > > @non_space_characters[non_space_characters] with > $non_space_characters[non_space_characters] > > The program below gets the first one only. How do I get the others? > > TIA > > Owen > ---

Re: Substitution/Regex problem

2004-04-29 Thread John W. Krahn
Owen wrote: > > I would like to replace all instances of > > @non_space_characters[non_space_characters] with > $non_space_characters[non_space_characters] > > The program below gets the first one only. How do I get the others? > > --- > #!/usr/

Re: Substitution/Regex problem

2004-04-29 Thread Damon Allen Davison
Hi Owen, I think I would do things a little differently. Owen wrote: I would like to replace all instances of @non_space_characters[non_space_characters] with $non_space_characters[non_space_characters] [...] $line=~s/(@)(\S+\[\S+\])/\$$2/g; __DATA__ @[EMAIL PROTECTED]@banana[4]; So this is my

Re: Substitution/Regex problem

2004-04-29 Thread Jose Alves de Castro
The problem is that your regex is matching the whole line: @ [EMAIL PROTECTED]@banana[4]; ^ ^ $1 $2 Instead, use non greedy matches: $line =~ s/(@)(\S+?\[\S+?\])/\$$2/g; and you'll get what you want: @ array[1] = @ array[2] +@ banana[4]; ^ ^

Substitution/Regex problem

2004-04-29 Thread Owen
I would like to replace all instances of @non_space_characters[non_space_characters] with $non_space_characters[non_space_characters] The program below gets the first one only. How do I get the others? TIA Owen --- #!/usr/bin/perl -w use strict;

Regex problem

2003-09-24 Thread Segree, Gareth
I have a directory of files that I want to move to another directory. (eg. ALLY20030111W.eps TEST W20030122 HELP WANTED20030901WW.eps GIRL WATCH BIRD 20030101 etc..) I want to be able to parse the filename and replace the date portion with any date (eg $1="ALLY" $2="20030111" $3="

  1   2   3   >