Re: REGEX help!

2004-01-13 Thread Glenn Linderman
cases. Do you think that Alex would want to match 192.168.10.10 ? I think so, but your regex wouldn't. See $Bill's reply, or the original Cookbook expression, for a much better suggestion. But to get back to one of the questions that Alex originally asked: alex p wrote: I have

Re: REGEX help!

2004-01-13 Thread Raul Davletshin
t; [aDc] true for "a" but not for "aa", or true for "D" but not for "aDc". \d => 0 1 2 3 4 5 6 7 8 9 [01]? => match zero or more occurrence of 0 OR 1. [0-4] => 0 1 2 3 4, but not all of them at same time. now your code: [0-254] => will match 0

Re: REGEX help!

2004-01-13 Thread Jamie Murray
digit 254 or less". or "two digit 54 or less"."three digit 254 or less"."three digit 254 or less"."three digit 254 or less" - Original Message - From: "alex p" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Mo

Re: REGEX help!

2004-01-12 Thread $Bill Luebkert
alex p wrote: > Hello all, > I have been trying to find a regex to validate IP ranges and found the > following: > > m{ >^ ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) > \. ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) > \. ( \d | [01]?\d\d | 2[0-4]\d | 25

Re: REGEX help!

2004-01-12 Thread Jamie Murray
think that cookbook regex is crap but anyways) your regex fails for a number of reasons. what you have there is looking to match ip in format of"two digits"."two digits"."two digits"."two digits". you regex should be if($num =~ /^[0-9]\.[0-9]\.[0-9]\.[0-9]$/

RE: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Ted S.
Thomas, Mark - BLS CTR graced perl with these words of wisdom: > For the letter-substitution matches, why not create mini-re for each > one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; > > if ($str =~ /v${i}${a}gr${a}/) { > #it's spam > } > Because Hamster d

Re: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Rob Dixon
Mark Thomas wrote: > > > (i|1|l|\|) to kill the vertical pipe, but I find that much > > harder to read and more difficult to extend later on. > > For the letter-substitution matches, why not create mini-re for each one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; >

RE: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Thomas, Mark - BLS CTR
> (i|1|l|\|) to kill the vertical pipe, but I find that much > harder to read and more difficult to extend later on. For the letter-substitution matches, why not create mini-re for each one? $a = qr/[EMAIL PROTECTED]/; $i = qr/[i1l\|]/; $str = "v|agr@"; if ($str =~ /v${i}${a}gr${a}/) {

RE: regex questions

2003-12-30 Thread Barak Dagan
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Wenjie Wang Sent: Tuesday, December 30, 2003 2:37 PM To: Rob Dixon; Wenjie Wang; [EMAIL PROTECTED] ActiveState. com Subject: RE: regex questions :-Original Message- :From: Rob Dixon [mailto:[EMAIL

RE: regex questions

2003-12-30 Thread Wenjie Wang
:-Original Message- :From: Rob Dixon [mailto:[EMAIL PROTECTED] [snap] : :> :> for issue 1), I can do something like: :> $myDataLine =~ /\s+M\s+\d{1,2}:\d{1,2}\s+(\w+\s\w+\s\w+|\w+\s\w+|\w+)/i; :> $1 is the value I want. :> It'll be nice if there is a more generic expression for it. : :Unles

Re: regex questions

2003-12-30 Thread Rob Dixon
Wenjie Wang wrote: > > I managed to sort out following regex issues, but I'd like to deal with them > in an elegant fashion:-) Suggestions? > > 1) extract one, two or more words in a line. The word/phases is separated > by more the

Re: regex and filename

2003-11-27 Thread $Bill Luebkert
Beckett Richard-qswi266 wrote: > Guys, > > Someone must have already done this, but I know I can't! > > I have an input file name, and using: > use File::Basename; > fileparse_set_fstype("MSWin32"); > my $file = fileparse ("$ARGV[0]"); > my $path = dirname ("$ARGV[0]"); > > I am splitting the

regex and filename

2003-11-27 Thread Beckett Richard-qswi266
Guys, Someone must have already done this, but I know I can't! I have an input file name, and using: use File::Basename; fileparse_set_fstype("MSWin32"); my $file = fileparse ("$ARGV[0]"); my $path = dirname ("$ARGV[0]"); I am splitting the input file name into $file and $path. I can handle t

AW: Regex in Mail::BulkMail

2003-11-06 Thread Wittrock, Friedel
sorry, \.[a-zA-Z]{2-4})\s*$ is wrong, \.[a-zA-Z]{2,4})\s*$ is ok. regards Friedel Wittrock -Ursprüngliche Nachricht- Von: Huub Peters [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 6. November 2003 09:42 An: [EMAIL PROTECTED] Betreff: Regex in Mail::BulkMail I'm using an

Re: Regex in Mail::BulkMail

2003-11-06 Thread Huub Peters
, Huub - Original Message - From: "Huub Peters" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 06, 2003 9:41 AM Subject: Regex in Mail::BulkMail > I'm using an older version of Mail::BulkMail that contains a regex to > validate an e-mail

AW: Regex in Mail::BulkMail

2003-11-06 Thread Wittrock, Friedel
I guess \.[a-zA-Z]{2-4})\s*$ is the answer, not tested regards Friedel Wittrock -Ursprüngliche Nachricht- Von: Huub Peters [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 6. November 2003 09:42 An: [EMAIL PROTECTED] Betreff: Regex in Mail::BulkMail I'm using an older versi

Re: Regex in Mail::BulkMail

2003-11-06 Thread $Bill Luebkert
Huub Peters wrote: > I'm using an older version of Mail::BulkMail that contains a regex to > validate an e-mail address. Problem is that it only excepts 2 or 3 > letters after the last dot. Nowadays we have new stuff like [EMAIL PROTECTED] > that doesn't pass this regex. >

Regex in Mail::BulkMail

2003-11-06 Thread Huub Peters
I'm using an older version of Mail::BulkMail that contains a regex to validate an e-mail address. Problem is that it only excepts 2 or 3 letters after the last dot. Nowadays we have new stuff like [EMAIL PROTECTED] that doesn't pass this regex. return $1 if $email =~ m<

Re: regex international phone #

2003-11-06 Thread Huub Peters
I agree that it seems a bit off but the regex in JavaScript is derived from Perl so i can understand why he posted to this list. - Original Message - From: "Javier Nunez" <[EMAIL PROTECTED]> To: "perl users" <[EMAIL PROTECTED]> Sent: Wednesday, Novemb

RE: Regex

2003-10-23 Thread Michael D. Smith
eck if the starting task was the same, convert time again Then calcul the difference in seconds. Regards, Christophe GAUDER -Message d'origine- De : ashish srivastava [mailto:[EMAIL PROTECTED] Envoyé : jeudi 23 octobre 2003 8:19 À : [EMAIL PROTECTED] Objet : Regex Hi , I need to parse a

AW: Regex question.

2003-10-20 Thread NPopovici
: [EMAIL PROTECTED]Betreff: Re: Regex question.Ooops: perldoc perlre   gives a little more on \B or try: http://www.perldoc.com/perl5.8.0/pod/perlfaq6.html#Why-don't-word-boundary-searches-with-%5cb-work-for-me- a Andy Bach, Sys. ManglerInternet: [EMAIL PROTECTED]    VOICE: (608) 261

Re: Regex question.

2003-10-20 Thread Jingmei_Guo
You can use matching like this ... if ($stringToSplit =~ /Cat/)  {        print "found the string\n"; } [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/20/2003 09:49 AM                 To:        [EMAIL PROTECTED]         cc:                 Subject:        Regex ques

Regex question.

2003-10-20 Thread NPopovici
Title: Regex question. Hi *,   I have a problem with a regex. I want to be able to detect if in some word I will find a subword , for example if "cat" is in "Pisiccat" . I have one ideea and that is to split the PisiCcat after cat and then to check if the first variab

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
Thank you for your help. Using binmode was indeed the solution. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
More testing shows that... These two statements fail: print "\nYES\n" if $data =~ /\x0D/s; print "\nYES\n" if $data =~ /\x0d/s; These two statements succeed: print "\nYES\n" if $data =~ /\x0A/s; print "\nYES\n" if $data =~ /\x0a/s; As I stated before two different HEX editors show od oa sequence

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Arms, Mike
t; To: 'Arms, Mike'; '[EMAIL PROTECTED]' > Subject: RE: RegEx to remove \x0D\x0A > > > More testing shows that... > > These two statements fail: > print "\nYES\n" if $data =~ /\x0D/s; > print "\nYES\n" if $data =~ /\x0d/s; > > The

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
Original Message- From: Arms, Mike [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 2:15 PM To: Bullock, Howard A. Subject: RE: RegEx to remove \x0D\x0A Did you add these two lines after reading in the file? print "len=", length( $data ), "\n"; print "data=&

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
For #1 and #2 below: The file has data. I have examined it in two different Hex editors and printed it to the display. For #3: my script has 'local $/'. Outlook though it was being helpful. :( I guess a simple question is should this be working? If so, I will continue to work with it. -

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
The final script will work against data file that I do not have. I am attempting to help someone else and hit this issue. The actual string to be removed is "\x20\x1B\x0D\x0A". In testing I can find the other characters but the RegEx engine does not seem to recognize the CRLF. You c

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Arms, Mike
Bullock, Howard A. [EMAIL PROTECTED] wrote: > My script slurps in a file > > Local $/; > $data = ; > > and want to remove the CRLF's. but even a simple RegEx match does not > succeed for me. > > These all have failed. > > print "\nYES\n" if

RE: RegEx to remove \x0D\x0A

2003-10-01 Thread Peter Eisengrein
Title: RE: RegEx to remove \x0D\x0A Are you sure they are CRLF's? And why regex? Why not chomp? Can you give us a bit of actual data? -Original Message- From: Bullock, Howard A. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 01, 2003 12:14 PM To: '[EMAIL PROTECTED

RegEx to remove \x0D\x0A

2003-10-01 Thread Bullock, Howard A.
My script slurps in a file Local $/; $data = ; and want to remove the CRLF's. but even a simple RegEx match does not succeed for me. These all have failed. print "\nYES\n" if $data =~ /\015\012/; print "\nYES\n" if $data =~ /\015\012/s; print "\nYES\n" if

Re: OT: Regex humor

2003-09-18 Thread Carl Jolley
On Thu, 18 Sep 2003, Ted Schuerzinger wrote: > This, I suppose, is proof that computers are only as bright as the people > who program them, and a good lesson on being careful what you look for in > your regexes :-) > > I've noticed that spammers sometimes try to get around people's spam > fi

OT: Regex humor

2003-09-18 Thread Ted Schuerzinger
;[EMAIL PROTECTED]> To: "Bayete Leriche" <[EMAIL PROTECTED]> Subject: Cool university degree deal for everybody! Well, it *does* match the regex, after all! :-) -- Ted Schuerzinger, [EMAIL PROTECTED] ___ Perl-Win32-Users m

RE: Regex Help Needed

2003-09-02 Thread Schneider, Kenneth (EKT)
t: Tuesday, September 02, 2003 12:26 PMTo: Perl UsersSubject: Regex Help Needed I have a list of characters.  I need to get a list of all possble sequences of these characters for example.    I have a string that consists of '-mevqgn' I need to pattern match any combinat

Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
$Bill Luebkert wrote: > Dax T. Games wrote: > > >>I have a list of characters. I need to get a list of all possble >>sequences of these characters for example. >> >>I have a string that consists of '-mevqgn' I need to pattern match any >>combination of 'mevqgn' with a preceding - or --. >> >

Re: Regex Help Needed

2003-09-02 Thread John Deighan
At 01:26 PM 9/2/2003, Dax T. Games wrote: I have a list of characters.  I need to get a list of all possble sequences of these characters for example.    I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --.   Right now this is w

RE: Regex Help Needed

2003-09-02 Thread Messenger, Mark
pha2) {print "Pattern found!\n";}       -Original Message-From: Dax T. Games [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 11:26 AMTo: Perl UsersSubject: Regex Help Needed I have a list of characters.  I need to get a list of all possble sequences of these cha

RE: Regex Help Needed

2003-09-02 Thread Arms, Mike
or ( @test ) { print "$_ " . is_DTG_Option( $_ ) . "\n"; } -- Mike Arms -Original Message- From: Dax T. Games [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 02, 2003 11:26 AM To: Perl Users Subject: Regex Help Needed I have a list of characters. I nee

Re: Regex Help Needed

2003-09-02 Thread Charlie Schloemer
Users" <[EMAIL PROTECTED]> Sent: Tuesday, September 02, 2003 12:26 PM Subject: Regex Help Needed I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match a

Re: Regex Help Needed

2003-09-02 Thread Carl Jolley
his assumes that the alphabetic string you want to match will be 6 characters long. If it could be of any arbitratry length but only consisting of the characters mevgn then the patters might be: /^-{1,2}[mevgn]*/. This also assumes that you are matching the beginning of a string. The regex u

RE: Regex Help Needed

2003-09-02 Thread Hanson, Rob
}    }       return 1;} -Original Message-From: Dax T. Games [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 1:26 PMTo: Perl UsersSubject: Regex Help Needed I have a list of characters.  I need to get a list of all possble sequences of these characters for exampl

Re: Regex Help Needed

2003-09-02 Thread Will of Thornhenge
Have you tried playing around with character sets? Something like $target = 'mevqgn'; $length_target = length $target; if ( $LS_Val =~ /-{1,2}[$target]{$length_target}/ ) { #do something } Whether the above would work for you would depend on whether the code can ignore positive matches on $LS_

RE: Regex Help Needed

2003-09-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO
    I wanted to use tr but was uanble to accomplish the task that way. So I used regex like the following:   use strict;   my %MCTWW = qw(m -1 e -1 v -1 q -1 g -1 n -1);my $MyCharsToWorkWith = \%MCTWW;   $_ = '--mepqgn ';   if ( ! /-{1,2}(\S+)/ ) {    printf "Expecting a

Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
Dax T. Games wrote: > I have a list of characters. I need to get a list of all possble > sequences of these characters for example. > > I have a string that consists of '-mevqgn' I need to pattern match any > combination of 'mevqgn' with a preceding - or --. > > Right now this is what I am d

Regex Help Needed

2003-09-02 Thread Dax T. Games
I have a list of characters.  I need to get a list of all possble sequences of these characters for example.    I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --.   Right now this is what I am doing but it is very ugly a

Re: Help with regex

2003-08-01 Thread $Bill Luebkert
Will of Thornhenge wrote: > I'm doing some work with mail headers that involves converting > timestamps to a standard format. The following regex works except for > one pesky trailing close parens. > > Here's a sample of the data that causes problems: > > ==samp

Re: Help with regex

2003-08-01 Thread Trevor Joerges [SendMIME Software]
quot;perl-win32-users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, August 01, 2003 8:54 PM Subject: Help with regex > I'm doing some work with mail headers that involves converting > timestamps to a standard format. The following regex works except for > one pesky trailing

Help with regex

2003-08-01 Thread Will of Thornhenge
I'm doing some work with mail headers that involves converting timestamps to a standard format. The following regex works except for one pesky trailing close parens. Here's a sample of the data that causes problems: ==sample data Date: Fri, 1 Aug 1997 08:10:16 -0700 (PDT) === This is

Re: easy newbie REGEX

2003-06-12 Thread Carl Jolley
On Tue, 10 Jun 2003, alex p wrote: > All, > I am really bad at REGEX's and am in need of help! > I have a script that asks for users input but I need to check that the input > begin with "MDS(and a number 0-9)" before proceeding > > below is something like what I am doing: > > print "ask for input

Re: easy newbie REGEX

2003-06-10 Thread alex p
} else{print "It worked\n";} } From: "Trevor Joerges \[SendMIME Software\]" <[EMAIL PROTECTED]> To: "alex p" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Subject: Re: easy newbie REGEX Date: Tue, 10 Jun 2003 15:57:52 -

Re: easy newbie REGEX

2003-06-10 Thread Trevor Joerges \[SendMIME Software\]
quot;alex p" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 10, 2003 3:17 PM Subject: easy newbie REGEX > All, > I am really bad at REGEX's and am in need of help! > I have a script that asks for users input but I need to check that the input &

Re: easy newbie REGEX

2003-06-10 Thread M Ajmal
how about something like: unless ($answer =~ /^MDS\d/) { print "Try again: "; } MA __ Post your free ad now! http://personals.yahoo.ca ___ Perl-Win32-Users mailing list [

easy newbie REGEX

2003-06-10 Thread alex p
All, I am really bad at REGEX's and am in need of help! I have a script that asks for users input but I need to check that the input begin with "MDS(and a number 0-9)" before proceeding below is something like what I am doing: print "ask for input"; chomp ($answer=); #(not sure which one to use be

Re: regex expressions

2003-04-12 Thread Eric Amick
On Sat, 12 Apr 2003 19:01:28 +, you wrote: >Got a quick (simple??) question. I can't seem to find an example of how to >do it!! > >I have the following string: > >$test = "my brother is not ok today and i want milk for food" > >I'd like to be able to place "is not ok today" in $1 and "want

regex expressions..

2003-04-12 Thread Bruce Douglas
Title: Message Hi   Got a quick (simple??) question. I can't seem to find an example of how to do it!!   I have the following string:        $test = "my brother is not ok today and i want milk for food"   I'd like to be able to place "is not ok today" in $1 and "want milk" in $2. Should

Regex

2003-03-25 Thread Merrill Cornish
Carlton, >>> /[backup,backup last]/i In re regex, [...] creates a character class, not a list of alternatives. For alternatives, use |. /backup|backup last/i Merrill ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscr

Regex

2003-03-25 Thread Gregory, Carlton
All, I have some code that looks like: [snip] print $toolcmd; if ($toolcmd =~ /[backup,backup last]/i) { open (loghandle, ">>" .$BK_LOGDIR . $BKLOGFILE) or die "Cannot create log file"; print "\n Updating Import Log at $BK_LOGDIR$BKLOGFILE \n"; print "\n Log Updated. \n"; print "\n W

RE: Regex help

2003-02-18 Thread Beckett Richard-qswi266
> I'm trying to match a string which would start with http://, > then a character string where there is one one or more > instances of "%", followed by one instance of ".com", i.e. > http://www.%55.com > > Here is my current pattern: > http://.*%+.*(\.com) > > However, if there are tw

Regex help

2003-02-18 Thread Andrew Staples
I'm trying to match a string which would start with http://, then a character string where there is one one or more instances of "%", followed by one instance of ".com", i.e. http://www.%55.com Here is my current pattern: http://.*%+.*(\.com) However, if there are two or more instance

Re: Regex question

2003-02-06 Thread Carl Jolley
On Thu, 6 Feb 2003, Richard Morse wrote: > On 02/06/2003 2:09 PM, "Ben Gonzalez" <[EMAIL PROTECTED]> wrote: > > > All, > > > > I have a string that can contain any number from 0 to 1048575. > > > > I can verify that the numbers are digits like t

Re: Regex question

2003-02-06 Thread Carl Jolley
On Thu, 6 Feb 2003, Ben Gonzalez wrote: > All, > > I have a string that can contain any number from 0 to 1048575. > > I can verify that the numbers are digits like this: ^\d{1,7}$ > > The above regex matches any 1 to 7 digits. It will ensure that the string > contains di

Re: Counting regex occurrences

2002-12-14 Thread Randy W. Sims
On 12/14/2002 10:02 AM, Bill Royds -Perl wrote: The key is $count = () = $string =~ /a/g; Which creates a list context for return of match operator $string =~/regex/g Then the $count= is asking for a scalar context return of a list, which we all know returns the count of elements in list

RE: Re: Counting regex occurrences

2002-12-14 Thread Bill Royds -Perl
The key is $count = () = $string =~ /a/g; Which creates a list context for return of match operator $string =~/regex/g Then the $count= is asking for a scalar context return of a list, which we all know returns the count of elements in list. The expression $count = (@temp) = $string =~ /a/g

Re: Counting regex occurrences

2002-12-14 Thread Kris Wolff
On 14.12.2002 11:57 Uhr, "Adrian Brinton" <[EMAIL PROTECTED]> wrote: > > #count the occurrences of "a" > $string = "aaabbbcccddd"; > $count = () = $string =~ /a/g; > print "Count is $count\n"; > This is really cool ! I never ever seen this kind of line. Is there any rule or document snipe or exp

Re: Re: Counting regex occurrences

2002-12-14 Thread Adrian Brinton
ences of "a" $string = "aaabbbcccddd"; $count = () = $string =~ /a/g; print "Count is $count\n"; Adrian Brinton > - Original Message - > From: "Coonfield, Ben CONT" <[EMAIL PROTECTED]> > Date: Thu, 12 Dec 2002 15:12:09 -0500 > To: [EMAIL PROTEC

RE: Counting regex occurrences

2002-12-12 Thread Vuillemot, Ward W
h then get forced to scalar # based on composition of $b $b = ($a =~ tr/a/a/); # verify we counted the number of 'a's in $a print $b; # bye exit; -Original Message- From: Coonfield, Ben CONT [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 12:12 PM To: [EMAIL PROT

Counting regex occurrences

2002-12-12 Thread Coonfield, Ben CONT
It seems like there should be a simpler way to count the number of occurrences of a regular expression. For example: @temp= / Current Value: /g; $count=@temp; I don't really care about @temp, I only want to get the value for $count. So how can I do this without creating a (named) temporary varia

Re: RegEx help

2002-11-15 Thread $Bill Luebkert
ashes make my client think your reply is your .sig - I wouldn't use them. Had to cut-n-paste your reply: Thanks. The main problem I was having was I couldn't find the "e" option for the RegEx. I did look again and still couldn't find it in "perlre". You looked

RE: RegEx help

2002-11-15 Thread Bullock, Howard A.
was I couldn't find the "e" option for the RegEx. I did look again and still couldn't find it in "perlre". My final code looks like this: my $x; $Text =~ s#(.*?)<\/blockquote># $x = $1; $x =~ s/|/\n/; $x =~ s/>\n//; sprintf '%s', $x ; #eg

Re: RegEx help

2002-11-14 Thread $Bill Luebkert
Bullock, Howard A. wrote: I want to alter some characters in a text variable, but only those between two markers. $text = 'axxxccvvvacasdcxaswrefajjawerasdcxaswrefajhhaasera'; I want to specify the start and the end and only change the a's to 8's between the markers. How do I accomplish this

Re: regex

2002-11-05 Thread $Bill Luebkert
Dovalle Yankelovich wrote: hi, im trying to check if one variable that contain a string is equal to another in my example the if evaluates to true each time 1) $tmp1 = "qw" $tmp2 = "rt" if ($tmp1 == $tmp2) { #some code } 2) $tmp1 = "qw" $tmp2 = "qw" if ($tmp1 == $tmp2) { #some code

regex

2002-11-05 Thread Dovalle Yankelovich
hi, im trying to check if one variable that contain a string is equal to another in my example the if evaluates to true each time   1)   $tmp1 = "qw" $tmp2 = "rt" if ($tmp1 == $tmp2) { #    some code }   2)   $tmp1 = "qw" $tmp2 = "qw" if ($tmp1 == $tmp2) { #    some code }   both time i

Re: [PBML] Regex With Common Applications

2002-10-21 Thread Jenda Krynicky
From: "William Martell" <[EMAIL PROTECTED]> > - > Hello Perl Users, > > I am curious whether there is a way to search a data store for a list > of values and if any of those values are matched, replace it with a > single common value. > >

RE: Regex With Common Applications

2002-10-21 Thread Stovall, Adrian M.
a\n";$data =~ s/$filter/BITE ME/gi;print "$data\n";   see if you can figure out how it works, and if you have trouble figuring it out, ask away... -Original Message-From: William Martell [mailto:[EMAIL PROTECTED]] Sent: Monday, October 21, 2002 1:49 PM

Re: Counting using a regex.

2002-09-18 Thread $Bill Luebkert
Phil Ritchie wrote: > I'm trying to count occurrences of patterns using > > $_ = 'ababcdabcd'; > while ($_ =~ m/\Gab/gc) > { > $num++; > } > while ($_ =~ m/\Gcd/gc) > { > $num++; > } > print $num; > > But it doesn't work. I have a feeling that I need to employ the pos > function somewher

Re: trying to understand how regex works

2002-08-13 Thread Thomas R Wyant_III
Ron Grabowski <[EMAIL PROTECTED]> wrote: > my $regex = join '|', 'value_garbage1', > 'value_garbage2', > 'value_garbage3'; > next if /$regex/; You might want to say "next if /$regex/o

RE: trying to understand how regex works

2002-08-13 Thread Joseph Youngquist
ED]]On Behalf Of $Bill Luebkert Sent: Tuesday, August 13, 2002 12:39 AM To: Dan Jablonsky Cc: [EMAIL PROTECTED] Subject: Re: trying to understand how regex works Dan Jablonsky wrote: > Hi all, > I guess it must be a simple problem, but it's a > mystery to me. > I got 30 "fields&qu

Re: trying to understand how regex works

2002-08-13 Thread csaba . raduly
On 13/08/2002 06:26:59 perl-win32-users-admin wrote: >Hi all, >I guess it must be a simple problem, but it's a >mystery to me. [snip question involving regex] > >Anybody cares to explain this to me? Try running your script with perl -re=debug scriptname.pl 2>re_debug

Re: trying to understand how regex works

2002-08-12 Thread Ron Grabowski
> open FOUT, ">>/some/path/outputfile.txt"; > open FILE ">/some/path/outputfile.txt") or die("Error: $!"); open(FILE " while{ > p="N"; > next if (/.*?\|value_garbage1\|.*?/ || > /.*?\|value_garbage2\|.*?/ || &

Re: trying to understand how regex works

2002-08-12 Thread $Bill Luebkert
$fld1=$newfld1; > $fld2=$2; > $fld3=$newfld3; > $fld4=$4;and so on > } > print FOUT "$fld1|$fld2|...|$fld30|\n" if ($p="Y"); > #print the whole thing to the new output > } > > Well, it happens that some of

trying to understand how regex works

2002-08-12 Thread Dan Jablonsky
int FOUT "$fld1|$fld2|...|$fld30|\n" if ($p="Y"); #print the whole thing to the new output } Well, it happens that some of the lines are completely out of whack and the regex simply stops there - it doesn't exit, no errors but goes into an infinite loop even though

Re: Regex matching pairs?

2002-05-23 Thread Ron Grabowski
--- use strict; use Text::Balanced qw(extract_bracketed); my $text = '{\f2\fs20 Da biste }{\cs6\f1\cf6\lang \{#}RES_ID{\cs6\f1\cf6\lang #\}} odaberite'; my($extracted, $remainder) = extract_bracketed($text,'{}'); print "$extracted\n$remainder\n"; print(($extracted =~ /^{.*?\s(.*)\s}$/)); --- {\f2

Re: Regex matching pairs?

2002-05-23 Thread csaba . raduly
Run this: perldoc -q balanced -- Csaba Ráduly, Software Engineer Sophos Anti-Virus email: [EMAIL PROTECTED]http://www.sophos.com US Support: +1 888 SOPHOS 9 UK Support: +44 1235 559933 __

RE: win-perl regex seems to miss 0,0 with s/(\w),(\w)/$1\a$2/g search logic

2002-04-12 Thread macnerd
You are just awesome Thanx. Also teaches me a lot too. :-) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Carl Jolley > Sent: Tuesday, April 09, 2002 11:51 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Sub

Re: regex: avoiding greedy pattern matching in perl

2002-02-28 Thread Carl Jolley
On Wed, 27 Feb 2002 [EMAIL PROTECTED] wrote: > Why should greedy pattern matching be avoided. > > my e.g: here > > $_ = "bambam"; > > #option1. > print if /.*?m/ ; > print "\n"; > > #option2. > print if /.m/; > print "\n"; > > #option3. > print if/.*m/; > prin

Re: regex: avoiding greedy pattern matching in perl

2002-02-28 Thread Carl Jolley
On Wed, 27 Feb 2002 [EMAIL PROTECTED] wrote: > Why should greedy pattern matching be avoided. > > my e.g: here > > $_ = "bambam"; > > #option1. > print if /.*?m/ ; > print "\n"; > > #option2. > print if /.m/; > print "\n"; > > #option3. > print if/.*m/; > prin

Re: Zero-suppression Regex

2002-02-18 Thread Dirk Bremer
regex to swap the signs, i.e. either make all output strings have leading or trailing signs, regardless of input. I changed my mind on the justification, the commify construct alters the length in a manner that could result in a string that is longer than the input, for the program which utilizes

Re: Zero-suppression Regex

2002-02-17 Thread $Bill Luebkert
Carl Jolley wrote: > On Fri, 15 Feb 2002, Dirk Bremer wrote: > > >>$Bill, it was not you who made a mistake with the benchmark, it was I and in the >process learned a lot of new things about the >>Benchmark module, which is a wonderful tool and should be used by anyone who is >interested in p

Re: Zero-suppression Regex

2002-02-17 Thread Carl Jolley
be more correctly coded as: s/(\d{$_[1]})$/\.$1/ if (@_ > 1 && $_[1] > 0); Won't "and $_[1] > 0" be executed even if @_ == 1? OTOH, won't $_[1] > 0 be false when @_ > 1 is false, i.e. could not the condition be safely collapsed to: if $_[1] >

RE: Zero-suppression Function (was Zero-suppression Regex)

2002-02-15 Thread Frazier, Joe Jr
> Reply-To: "Dirk Bremer" <[EMAIL PROTECTED]> > From: "Dirk Bremer" <[EMAIL PROTECTED]> > To: "'Perl Win32 Users Mailing List'" > <[EMAIL PROTECTED]> > Subject: Re: Zero-suppression Regex > Date: Thu, 14 Feb 2002 1

Re: Zero-suppression Regex

2002-02-14 Thread $Bill Luebkert
the list has more two elements, move the sign-character > # from the leftmost position to the position of the rightmost > # space character. > if ($i > 1) {substr($self,$i - 1,1) = $c; substr($self,0,1) = ' ';} > } > >

Re: Zero-suppression Regex

2002-02-14 Thread Dirk Bremer
x27; ';} } return($self); } After running some more benchmarks, this routine is several orders of magnitude faster than sprinf or a regex. Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters 636-922-9158 ext. 652 fax 636-447-4471 [EMAIL PROTECTED] www

Re: Zero-suppression Regex

2002-02-12 Thread Dirk Bremer
00';$num = sprintf('%1.2f',$num);}, 'regex' => sub {my $num = '0.00';$num =~ s/\b0+(?=\d)//;}}); } returns: Benchmark: timing 10 iterations of regex, sprintf... regex: 2 wallclock sec ( 2.30 usr + 0.00 sys = 2.30 CPU) @ 43402.

RE: Zero-suppression Regex

2002-02-12 Thread Alistair . McGlinchy
Dirk, If you really want a general solution to get rid of initial zeros without affecting the remainder of the string, then I stand corrected; a regex would probably be best. Consider my high horse bruised, following an incident with a low bridge :-) One last try though before my horse is

Re: Zero-suppression Regex

2002-02-12 Thread Dirk Bremer
In my instance, the 0+ solution would not produce the results I desire. For example, imagine the input string is "000.00" as in a dollar amount. The result I desire is "0.00", while the 0+ method results in "0". The regex that Joe provided produced my desi

RE: Zero-suppression Regex

2002-02-12 Thread Joseph P. Discenza
[EMAIL PROTECTED] wrote, on Tuesday, February 12, 2002 12:36 PM : Why not just use 0+$_ and let perl work its magic. I challenge any of you : regex "pushers" out there to write a regex that beats this in either speed : or elegance. Oh, of course. Duh. I had blinders on from the OP'

Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt
Very nice. Thanks. --- Jim --- $Bill Luebkert <[EMAIL PROTECTED]> wrote: > use strict; > > my @nums = qw(00123 04 004.01 000 00 0 .0 0.01 > 0012.001 000.0001); > $_ = join ' ', @nums; # save orig for bottom part > > foreach (@nums) { > print "$_ => "; > s/(? print "$_\n";

Re: Zero-suppression Regex

2002-02-10 Thread $Bill Luebkert
Jim Angstadt wrote: > Dear Joe and Dirk, > > Thanks for getting me to look at assertions. > > Expanding the requirement a little, > here is what I have so far: > > my @nums = qw/ 00123 04 004.01 000 00 0 .0 >0.01 0012.001 000.0001 /; > foreach ( @nums ) { >s/(\b)0+(?=\d)(\

Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt
Dear Joe and Dirk, Thanks for getting me to look at assertions. Expanding the requirement a little, here is what I have so far: my @nums = qw/ 00123 04 004.01 000 00 0 .0 0.01 0012.001 000.0001 /; foreach ( @nums ) { s/(\b)0+(?=\d)(\.*.*)/$1$2/g; # fails on 0.01 print $_,

<    1   2   3   4   >