Re: regular expression, this but not that

2011-09-18 Thread Gabor Szabo
On Mon, Sep 19, 2011 at 7:38 AM, Jer A wrote: > All, > > lets say i want to test if a string contains "pig" but not "dog" and/or not > "cat" > > i tried something like this: > >  =~ m/[^dog]|[^cat]|pig/ig > > what is the best way of going about this, using one regex? > > your help is very much app

Re: regular expression, this but not that

2011-09-18 Thread Glenn Linderman
On 9/18/2011 9:38 PM, Jer A wrote: All, lets say i want to test if a string contains "pig" but not "dog" and/or not "cat" i tried something like this: =~ m/[^dog]|[^cat]|pig/ig what is the best way of going about this, using one regex? your help is very much appreciated, perhaps the fol

RE: Regular expression with variable

2006-11-11 Thread Jerry Kassebaum
>I have a regular expression problem > >how do i use scalar variables in substitution and complex matching? > >eg I want the following to work. > >$string =~ s/^$variable//; > >$string =~ m/^([^$variable]*)/; > > >thanks in advance for your help. > >-Jeremy A. $x = "Cowboy"; $y = "ow"; $x =~ s/$y/

RE: Regular expression question

2006-08-01 Thread Joe Discenza
Title: Regular expression question Cai, Lucy (L.) wrote, on Monday, July 31, 2006 8:21 PM : My $file = "c:\temp\zips\ok.txt"; : How can I split the $file to get the only path: : My $dir = "c:\temp\zips"; : My $file = "ok.txt"; May I suggest you use File:Basename instead of a regex? Joe

RE: Regular expression question

2006-08-01 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Title: Regular expression question From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cai, Lucy (L.)Sent: Monday, July 31, 2006 17:21To: Cai, Lucy (L.); perl-win32-users@listserv.ActiveState.com; perl-unix-users@listserv.ActiveState.com; [EMAIL PROTECTED]; [EMAIL PROTECTED]Sub

Re: Regular expression question

2006-04-27 Thread Chris Wagner
At 09:45 PM 4/26/2006 -0400, Cai, Lucy \(L.\) wrote: >return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0); >$Output ="/vobs/na_mscs_pvob >/ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs public (ucmvob,replicated)" > >What I want to do is if this tring include word "ucmvob", then return 1, >else re

Re: Regular expression question

2006-04-26 Thread Ted Schuerzinger
"Cai, Lucy (L.)" <[EMAIL PROTECTED]> graced perl with these words of wisdom: > return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0); > > } > ** > > $Output ="/vobs/na_mscs_pvob > /ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs p

RE: Regular expression question

2006-04-26 Thread Timothy Johnson
Well, there are a couple of issues here. First off, I don't think this would even compile, because you used /s instead of \s. Secondly, your regex is looking for: .* zero or more of any character (unnecessary, since you didn't anchor the start

Re: Regular Expression

2005-11-29 Thread Foo Ji-Haw
$String = 'Integration Test Lead: \ul\b0 \tab\tab\tab Kimberly Kim\tab\tab\tab\tab\tab\tab \par'; How would I extract "Kimberly Kim" from the string using regular expression. Is there a way using expression to skip "\[characters]" ( like \tab ) and search for only real words, maybe between sp

Re: Regular Expression

2005-11-28 Thread Chris Wagner
At 05:40 PM 11/28/2005 -0800, Wong, Danny H. wrote: >$String = 'Integration Test Lead: \ul\b0 \tab\tab\tab Kimberly >Kim\tab\tab\tab\tab\tab\tab \par'; > >How would I extract "Kimberly Kim" from the string using regular >expression. Is there a way using expression to skip "\[characters]" ( >like

Re: Regular expression

2005-09-15 Thread $Bill Luebkert
$Bill Luebkert wrote: > You can also use quotemeta (look it up) or escape your .'s in $number (ie: > "1\.2\.3\.4"). That should have been '1\.2\.3\.4' or "1\\.2\\.3\\.4". -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesM

Re: Regular expression

2005-09-15 Thread $Bill Luebkert
Wong, Danny H. wrote: > Hi Perl Gurus, > I have a regular expression question. > I have a variable > $Number = "1.2.3.4" > > When I use the variable $Number as part of my regular expression, the > "." character gets interpret as any character. How do I make it a > literal "." that I'm searc

Re: Regular expression

2005-09-15 Thread Сергей Черниенко
Hello Danny, Thursday, September 15, 2005, 9:28:44 AM, You wrote: WDH> $Number = "1.2.3.4" WDH> When I use the variable $Number as part of my regular expression, the WDH> "." character gets interpret as any character. How do I make it a WDH> literal "." that I'm searching for? WDH> Example: WD

Re: Regular expression

2005-09-15 Thread Foo Ji-Haw
Don't know if this works, but have you tried: $string = "1\\.2\\.3"; - Original Message - From: "Wong, Danny H." <[EMAIL PROTECTED]> To: "Sisyphus" <[EMAIL PROTECTED]>; "Jan Dubois" <[EMAIL PROTECTED]>; "perl-win32-users" Sent: Thursday, September 15, 2005 2:28 PM Subject: Regular expre

RE: Regular Expression Help Please

2005-02-08 Thread Chris
-Original Message- One of the columns I'm calling out of my database is the email one. I'ts in MAPI format, so I need to extract the very last part. So the bottom example I would need to grab JDoe MAPI:{Doe, John}EX:/o=Company/ou=Site/cn=Recipients/cn=JDoe Then I can append the res

Re: Regular Expression Help Please

2005-02-08 Thread Chris Wagner
You can get that plus some other info with this regex: $string = 'MAPI:{Doe, John}EX:/o=Company/ou=Site/cn=Recipients/cn=JDoe'; ($lastname, $firstname, $mailid) = $string =~ m/^.+?\{(\w+), (\w+)\}.+?cn\=(\w+)$/; At 09:46 PM 2/8/05 +, steve silvers wrote: >One of the columns I'm calling out o

RE: Regular Expression Help Please

2005-02-08 Thread Charles K. Clarkson
From: [EMAIL PROTECTED] <> wrote: : One of the columns I'm calling out of my database is the email : one. I'ts in MAPI format, so I need to extract the very last : part. So the bottom example I would need to grab : : JDoe : : MAPI:{Doe, John}EX:/o=Company/ou=Site/cn=Recipients/cn=JDoe : : : Th

RE: Regular Expression Help Please

2005-02-08 Thread Gerber, Christopher J
-Original Message- > One of the columns I'm calling out of my database is the email one. I'ts in MAPI format, > so I need to extract the very last part. So the bottom example I would need to grab > > JDoe > > MAPI:{Doe, John}EX:/o=Company/ou=Site/cn=Recipients/cn=JDoe Steve, An easy way

RE: Regular expression to test for numeric values

2004-04-02 Thread Beckett Richard-qswi266
> So I get: > > /^-?(?:\d+\.?\d*|\.\d+)$/ I'm being thrown by the ?: What's that all about? R. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Regular expression to test for numeric values

2004-04-01 Thread Dial Joe
How about this (direct from "The Perl Cookbook"[1]) ?? warn "has nondigits"if /\D/; warn "not a natural number" unless /^\d+$/; # rejects -3 warn "not an integer" unless /^-?\d+$/; # rejects +3 warn "not an integer" unless /^[+-]?\d+$/; warn "not a

RE: Regular expression to test for numeric values

2004-04-01 Thread Peter Eisengrein
Title: RE: Regular expression to test for numeric values use Scalar::Util; if (Scalar::Util::looks_like_number $num) {     print "Yes, $num is a number\n"; } else {     print "no.\n"; } ... found it with perldoc -q number, which also showed a number of rege

RE: Regular expression to test for numeric values

2004-04-01 Thread Joseph Discenza
Gerber, Christopher J wrote, on Thursday, April 01, 2004 2:12 PM : -Original Message- : My guess is that I need a regex that will match on any character that is: : not 0-9 : or : more than one "." : or : more than one "-" : or if "-" is not the fir

RE: Regular expression to test for numeric values

2004-04-01 Thread Gerber, Christopher J
-Original Message- My guess is that I need a regex that will match on any character that is: not 0-9 or more than one "." or more than one "-" or if "-" is not the first character of the string Any ideas? Is it possible to do without usi

RE: Regular expression to test for numeric values

2004-04-01 Thread Peter Guzis
$txtype = 0 unless $txtype =~ /^-{0,1}\d+(?:\.\d+){0,1}$/; Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Motter, Jeffrey D [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 10:40 AM To: Perl-Win32-U

Re: regular expression question

2004-04-01 Thread Michael 'topdog' Thompson
Stacy Doss wrote: $a = "this is a (test)"; $a =~ s/\W+/_/g; HTH -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 11:28 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: regular _expression_ qu

RE: regular expression question

2004-04-01 Thread Peter Guzis
PROTECTED]; [EMAIL PROTECTED] Subject: RE: regular expression question Thanks for the replying. I have another question, if I have a string like $a = "this is a (test)"; How can I change it to $a = "this_is_a_test"; How can I remove ()? Thanks Lixin -Original Messa

RE: regular expression question

2004-04-01 Thread Stacy Doss
$a = "this is a (test)"; $a =~ s/\W+/_/g; HTH -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 11:28 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: regular expression question Than

RE: regular expression question

2004-04-01 Thread Cai_Lixin
$Bill Luebkert Sent: Wednesday, March 31, 2004 8:27 PM To: [EMAIL PROTECTED] Subject: Re: regular expression question Wagner, David --- Senior Programmer Analyst --- WGO wrote: Hey guys - what's with the HTML ? > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > [

Re: regular expression question

2004-03-31 Thread $Bill Luebkert
Wagner, David --- Senior Programmer Analyst --- WGO wrote: Hey guys - what's with the HTML ? > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > [EMAIL PROTECTED] > Sent: Wednesday, March 31, 2004 16:49 > To: [EMAIL PROTECTED] > Subject: regular expression question > > I have a $a

RE: regular expression replacement

2003-11-28 Thread shonorio
$Value = 'c:\qqq\www\'; $Value =~ s/\\/\//g; print $Value ; De: [EMAIL PROTECTED] em 28/11/2003 09:15 GMT Para: "'Kaufman Eran (StarHome)'" <[EMAIL PROTECTED]> [EMAIL PROTECTED] cc: Assunto: RE: regular expression replacement

RE: regular expression replacement

2003-11-28 Thread Beckett Richard-qswi266
Hi, I would like to know how can I replace the value c:\qqq\www\ to c:/qqq/www/. I tried several ways, but didn't manage to. Thanks, Eran s!\\!/!g ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveStat

RE: regular expression replacement

2003-11-28 Thread Kraaijer Ronald
How about a regular expressions like $string = 'c:\qqq\www\' ; $string =~ s/\\/\//g; That should do the trick. -Original Message- From: Kaufman Eran (StarHome) [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 10:38 AM To: [EMAIL PROTECTED] Subject: regular expression re

RE: Regular Expression problem?

2003-09-26 Thread Carl Jolley
On Fri, 26 Sep 2003, Xu, Qiang (XSSC SGP) wrote: > Ted S. wrote: > > Beckett Richard-qswi266 graced perl with these words of wisdom: > >> That should have been s/.*\/// > > > > Don't you have to escape the period, too? > > > > s/\.*\/// > > No, we shouldn't, because here "." stands for any single

RE: Regular Expression problem?

2003-09-25 Thread Xu, Qiang (XSSC SGP)
Glenn Linderman wrote: > Any delimiter can be used (other posters were correct about that). > The delimiter used affects which delimiter character would need to be > escaped in the regular expression. Generally, if something other > than / is used as the delimiter character, it is chosen because

RE: Regular Expression problem?

2003-09-25 Thread Xu, Qiang (XSSC SGP)
Strohmeier Ruediger wrote: > Hi Xu Qiang, > > unlike e.g. awk, vi or the shell, perl support different delimiter > for regexes. When a slash is part of the regex or the substitution > pattern, they can either be escaped (i.e. \/) or other characters can > be used as delimiters. > > Thus the reg

RE: Regular Expression problem?

2003-09-25 Thread Xu, Qiang (XSSC SGP)
Ted S. wrote: > Beckett Richard-qswi266 graced perl with these words of wisdom: >> That should have been s/.*\/// > > Don't you have to escape the period, too? > > s/\.*\/// No, we shouldn't, because here "." stands for any single character except a new line. thx, Regards, Xu Qiang __

Re: Regular Expression problem?

2003-09-25 Thread Glenn Linderman
On approximately 9/25/2003 6:45 AM, came the following characters from the keyboard of Xu, Qiang (XSSC SGP): Hi, all: I have a regular expression that I can't understand. Suppose $filename is a file name that includes the full path. Say, it is "/u/scan/abc.jpg", The regular expression is: $fil

Re: Perldoc problem was Re: regular expression on military time

2003-07-27 Thread John
t; Sent: Sunday, July 27, 2003 3:07 AM > Subject: Perldoc problem was Re: regular expression on military time > > >> If it does work, invoke 'path c:\perl\bin;%path%' at the prompt to >> change the path variable for the current console session then 'cd'

Re: Perldoc problem was Re: regular expression on military time

2003-07-27 Thread Ted S.
On 27 Jul 2003, Gerry Green wrote in perl: > Just a quick note: > > - Original Message - > From: "John" <[EMAIL PROTECTED]> > To: "Ted S." <[EMAIL PROTECTED]> > Cc: "Perl-Win32-Users" <[EMAIL PROTECTED]> > Sent: Sun

Re: Perldoc problem was Re: regular expression on military time

2003-07-27 Thread Gerry Green
Just a quick note: - Original Message - From: "John" <[EMAIL PROTECTED]> To: "Ted S." <[EMAIL PROTECTED]> Cc: "Perl-Win32-Users" <[EMAIL PROTECTED]> Sent: Sunday, July 27, 2003 3:07 AM Subject: Perldoc problem was Re: regular expression on

Perldoc problem was Re: regular expression on military time

2003-07-27 Thread John
On Saturday, July 26, 2003 12:05 AM AEST, Ted S. wrote: > On 25 Jul 2003, John McMahon wrote in perl: > >> Ted >> >> When you produced the output of 'set' below how did you get to the >> CLI console (command line interpreter aka DOS prompt)? This console >> was opened in the 'Windows' directory.

Re: regular expression on military time

2003-07-25 Thread Ted S.
On 25 Jul 2003, John McMahon wrote in perl: > Ted > > When you produced the output of 'set' below how did you get to the CLI > console (command line interpreter aka DOS prompt)? This console was > opened in the 'Windows' directory. > > What was different in *HOW* you got to this console *TO HOW*

RE: regular expression on military time

2003-07-21 Thread Carl Jolley
On Fri, 18 Jul 2003, Ted S. wrote: > On 18 Jul 2003, Carl Jolley wrote in perl: > > > On Thu, 17 Jul 2003, Ted S. wrote: > > > >> On 17 Jul 2003, Tobias Hoellrich wrote in perl: > >> > >> > my @t=("08:00", "23:59", "00:00", "aa:00", "24:00", " 00:01", > >> > "8:00", "08.00", "36:12", "08:61" ); fo

RE: regular expression question

2003-03-28 Thread Cai_Lixin
Thanks Lixin -Original Message- From: Todd Hayward [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 12:26 PM To: [EMAIL PROTECTED] Subject: Re: regular expression question Borrowing from the previous example of: > open(fHandle, "myfile.txt|"); > while (defin

Re: regular expression question

2003-03-28 Thread viktoras
This works: open (INPUT ,"your_input.txt") || die "$!"; open (OUTPUT, "> your_output.txt") || die "$!"; while () { if (m/GENERIC_MULTILINE/) { $_="GENERATION 116 # Impossible dependency # Needed to prevent FC4700 to CX-series upgrades DEPEND Navisphere >2.0.0.0.0 DEPEND Navisphere <1.0.0.0.0 GEND

RE: regular expression question

2003-03-28 Thread Adam Frielink
> > I have another question, > > I have string like "> GENERATION 116", How can I get rid of ">", of the > string? If you want to remove the 1st character if it is a ">", then use this... $var =~ s/>//; $var =~ s/^>//; #This removes it only if it is the first character ___

RE: regular expression question

2003-03-28 Thread Gerber, Christopher J
3 11:58 AM > To: [EMAIL PROTECTED] > Subject: RE: regular expression question > > > I have another question, > > I have string like "> GENERATION 116", How can I get rid of > ">", of the > string? > > Thanks > > Lixin > >

RE: regular expression question

2003-03-28 Thread Cai_Lixin
I have another question, I have string like "> GENERATION 116", How can I get rid of ">", of the string? Thanks Lixin -Original Message- From: Todd Hayward [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 11:30 AM To: [EMAIL PROTECTED]; [EMAIL PROTE

Re: regular expression question

2003-03-28 Thread thomas . baetzler
[EMAIL PROTECTED] schrieb: > I have a txt file like the bottom (I use cleardiff to > compare 2 files and > get this file): I would recommend that you look at Parse::RecDescent. Go grab the distribution from CPAN and have a look at the tutorial - the first example shows you how to parse a diff. h

Re: Regular Expression matching problem

2003-03-14 Thread Carl Jolley
On Sun, 9 Mar 2003, Electron One wrote: > Hello Everyone, > > If I have a file that contains this, > > test3.txt## > wilma > > wimagren was here > > twilma was type wilma > > wilma > > wilma > > wilma > > twowilm

Re: Regular Expression matching problem

2003-03-10 Thread Phil Ritchie
Not if the fourth to sixth lines don't have a space before the end of line. Try if(/wilma\s*/). Actually, you'll need to use if(/wilma/g) to catch them all. Phil. |-+---> | | Electron One| | |

Re: Regular Expression matching problem

2003-03-09 Thread Keith C. Ivey
Electron One <[EMAIL PROTECTED]> wrote: > while(<>){ > chomp; > if(/wilma\s+/){ >print "wilma was mentioned\n"; >} > } > > # > > and I type, perl -w perlname.pl test3.txt > shouldnt th

RE: regular expression question

2002-11-23 Thread Carl Jolley
On Fri, 22 Nov 2002, Stovall, Adrian M. wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Friday, November 22, 2002 4:38 PM > > To: Stovall, Adrian M.; [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subj

Re: regular expression question

2002-11-23 Thread Carl Jolley
On Fri, 22 Nov 2002 [EMAIL PROTECTED] wrote: > all, > > I want to check the first line of the file if it is machine or not, like > > The first line of the file is: > > Job "\nest and \toolbox VOBs" began execution on 9/6/02 at 2:00:11 AM. > > my code is like: > > if (!-z $file) > { > o

RE: regular expression question

2002-11-22 Thread Cai_Lixin
Yes, it works fine for me! Thanks a lot! Have a nice day. Lixin -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 5:42 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: regular expression question > -Original Mess

RE: regular expression question

2002-11-22 Thread Stovall, Adrian M.
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 22, 2002 4:38 PM > To: Stovall, Adrian M.; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: regular expression question > > > I tried that, it does

RE: regular expression question

2002-11-22 Thread Cai_Lixin
I tried that, it does not work for me! Lixin -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 5:28 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: regular expression question Cai Lixin said: > > > all, >

RE: regular expression question

2002-11-22 Thread Stovall, Adrian M.
Cai Lixin said: > > > all, > > I want to check the first line of the file if it is machine > or not, like > > The first line of the file is: > > Job "\nest and \toolbox VOBs" began execution on 9/6/02 at 2:00:11 AM. > > my code is like: > > if (!-z $file) > { > open(LOG_FILE, "<

RE: regular expression question

2002-11-22 Thread Cai_Lixin
Sorry, I did not state quite clear, if it is machine or not, I want to say if I it is the right file or not... Lixin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 5:07 PM Cc: [EMAIL PROTECTED] Subject: regular expression question a

RE: Regular Expression Problem

2002-11-20 Thread Joseph P. Discenza
Lee Cullip wrote, on Wednesday, November 20, 2002 08:06 : $prmpt =~ /^(.*:\/home\/oracle[:=>]{1,2})/; : $telnet = new Net::Telnet(-prompt => $prmpt, -Errmode => 'die'); : I still get the following error message though : : : bad match operator: opening delimiter missing: : ^(.*:/home/oracle[

Re: Regular Expression Problem

2002-11-20 Thread csaba . raduly
On 20/11/2002 13:06:29 Lee Cullip wrote: >Thanks for replying Joe, >maybe if you see a bit more code you can get an idea for what I'm trying to >do : > >use Net::Telnet; >use IO::File; > >$prmpt =~ /^(.*:\/home\/oracle[:=>]{1,2})/; [snip] > >I still get the following error message though : > >ba

Re: Regular Expression Problem

2002-11-20 Thread Lee Cullip
WTH am I doing wrong ? TIA Lee - Original Message - From: "Joseph P. Discenza" <[EMAIL PROTECTED]> To: "Lee Cullip" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 20, 2002 12:35 PM Subject: RE: Regular Expression Problem Lee Cul

RE: Regular Expression Problem

2002-11-20 Thread Joseph P. Discenza
Lee Cullip wrote, on Wednesday, November 20, 2002 06:50 : Can anybody tell me what is wrong with the following line ? : : $prmpt = /(^.*[:]\/home\/oracle[:=>]{1,2})/; : : I'm trying to use the value of $prmpt in a call to Net::Telnet but before I can : use the variable $prmpt, perl is complainin

Sorry (was RE: Regular Expression Help)

2002-06-12 Thread Lee Goddard
n others, but lets remember that we is all brothers in alms with >our won common >language - Perl ; ) > >Flame at will! > >-Original Message- >From: Ron Grabowski [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, June 12, 2002 2:16 AM >To: [EMAIL PROTECTED] >Subject

RE: Regular Expression Help

2002-06-11 Thread Allegakoen, Justin Devanandan
lets remember that we is all brothers in alms with our won common language - Perl ; ) Flame at will! -Original Message- From: Ron Grabowski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 2:16 AM To: [EMAIL PROTECTED] Subject: Re: Regular Expression Help > >phone numbe

Re: Regular Expression Help

2002-06-10 Thread steve silvers
: $query->('areacode') =~ m/\d{3}/g; I want to make sure that there is only 3 digits, not two, or four. Steve. >From: "Stephen J Martin" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: "steve silvers" <[EMAIL PROTECTED]> >CC: [EMAIL PROTEC

RE: Regular Expression Help

2002-06-10 Thread Michael D. Smith
There is the example from the Camel book for putting in commas, 1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/; which can easily be modified from three and comma, to two and a space: 1 while s/(\d)(\d\d)(?!\d)/$1 $2/; Which also leaves odd ones on the left. The previous solution put them on the right.

RE: Regular Expression Help

2002-06-10 Thread Stephen J Martin
On Mon, 10 Jun 2002 10:29:28 Arms, Mike wrote: >>PS I have learned something from this post, I didn't know you could >>define a string using brackets as you have done... > >Except that what you learned: > > $a = (12345678904539); > >is a bad practise. It is a novice mistake. What is being don

RE: Regular Expression Help

2002-06-10 Thread Stephen J Martin
On Mon, 10 Jun 2002 11:38:29 Rubinow, Larry wrote: >Jim Angstadt wrote: > >> produces: >> * 12 34 56 71 23 4* >> *12 34 56 71 234* >> *12 34 56 71 23 4* >> >> * 12 34 56 71 23 45* >> *12 34 56 71 23 45* >> *12 34 56 71 23 45 * >> >> * 12 34 5

RE: Regular Expression Help

2002-06-10 Thread Rubinow, Larry
Jim Angstadt wrote: > When I run this snippet below, using the three > approaches from others, there are three slightly > different results. See results at end. > > Please note spaces at start and end of some results. > Also, note results with a number of odd length. > > Perhaps the differen

RE: Regular Expression Help

2002-06-10 Thread Jim Angstadt
--- Stephen J Martin <[EMAIL PROTECTED]> wrote: > On Mon, 10 Jun 2002 09:10:05 > Joseph Youngquist wrote: > >This worked for me, > >$a = 12345678904539; > >@numbers = split(/(\d{2})/, $a); > >$NewA = join(' ', @numbers); > >print "\nNew A: $NewA"; > > >-Original Message- > >From: >

RE: Regular Expression Help

2002-06-10 Thread Arms, Mike
$a = (abc); # this is an error! -- Mike Arms -Original Message- From: Stephen J Martin [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 8:51 AM To: steve silvers Cc: [EMAIL PROTECTED] Subject: Re: Regular Expression Help On Mon, 10 Jun 2002 13:38:52 steve silvers wrote: >How can

Re: Regular Expression Help

2002-06-10 Thread Stephen J Martin
On Mon, 10 Jun 2002 13:38:52 steve silvers wrote: >How can I put a white space between every second number. > >I have $a = (12345678904539); >I want 12 34 56 78 90 45 39 > >I'm trying > >$a =~ s/\\d[2*]/ /g; #This obviously dosen't work :-( > >Also how can I tell if there are 3,4, or 5 digits.

RE: Regular Expression Help

2002-06-10 Thread Stephen J Martin
On Mon, 10 Jun 2002 09:10:05 Joseph Youngquist wrote: >This worked for me, >$a = 12345678904539; >@numbers = split(/(\d{2})/, $a); >$NewA = join(' ', @numbers); >print "\nNew A: $NewA"; >-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED]]On Behalf Of >steve silver

RE: Regular Expression Help

2002-06-10 Thread Rubinow, Larry
Joseph Youngquist wrote: > This worked for me, > > $a = 12345678904539; > > @numbers = split(/(\d{2})/, $a); > > $NewA = join(' ', @numbers); > > print "\nNew A: $NewA"; Or, more simply, s/(\d\d)(?=\d\d)/$1 /g; ___ Perl-Win32-Users mailing list [

RE: Regular Expression Help

2002-06-10 Thread Joseph Youngquist
This worked for me, $a = 12345678904539; @numbers = split(/(\d{2})/, $a); $NewA = join(' ', @numbers); print "\nNew A: $NewA"; hth, Joe Y. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of steve silvers Sent: Monday, June 10, 2002 8:39 AM To: [EMAIL

RE: Regular Expression

2002-05-05 Thread Mike G
At 05:59 PM 05/05/2002, you wrote: >Hi Steve, > >This may not be the most eficient way, but it seems to work. > >Someone will undoubtedly offer another (probably better) way to do it. This is good, but more than necessary... >Toby > > >my @numbers = qw(01 02 03 03 05 08 09 12 14 13 11 18 17 12 1

RE: Regular Expression

2002-05-05 Thread Toby Stuart
Hi Steve, This may not be the most eficient way, but it seems to work. Someone will undoubtedly offer another (probably better) way to do it. hth Toby my @numbers = qw(01 02 03 03 05 08 09 12 14 13 11 18 17 12 15 16 15 16 12 13 14 16 17 22 23 24 25 25 23 22 21 20); my %counts; &occur_in_arr

Re: Regular Expression Question

2002-03-04 Thread Tim . Moose
Resending because I never saw the message post. Sorry if duplicate. Try this # my $text = "this is a website: www.hello-world.com and an e-mail: [EMAIL PROTECTED]"; @found = $text =~ m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?)+))/g; print "Fo

RE: Regular Expression Question

2002-03-04 Thread Joseph Youngquist
, Richard E. Sent: Monday, March 04, 2002 3:32 PM To: 'Joseph Youngquist'; [EMAIL PROTECTED] Subject: RE: Regular Expression Question I think that you may need to do this in a while loop: my @items while($text =~ m/your string here/g) { push @items, $1; } print join("\n&

RE: Regular Expression Question

2002-03-04 Thread Joseph Youngquist
tml. Thanks for the idea, I'll poke about with it...if no one sends a yes/no to the question above. Joe Y. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jeffrey Sent: Monday, March 04, 2002 3:51 PM To: [EMAIL PROTECTED] Subject: RE: Regular Expression

Re: Regular Expression Question

2002-03-04 Thread Tim . Moose
Try this # my $text = "this is a website: www.hello-world.com and an e-mail: [EMAIL PROTECTED]"; @found = $text =~ m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?)+))/g; print "Found something interesting:\n", join "\n", @found if @found; # which uses t

RE: regular expression

2002-02-01 Thread Tillman, James
> $name[0] = "tom???.???"; > $name[1] = "tom*.???"; > > into > > $name[0] = "tom[a-z|A-Z]{3}.[a-z|A-Z]{2}"; > $name[1] = "tom*.[0-9]{3}"; > > So I can build a grep command to get all the files in this directory. > the purpose is to look through all files and check it's attributes. I be

RE: regular expression

2002-02-01 Thread Wang, Pin-Chieh
purpose is to look through all files and check it's attributes. PC -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 3:23 PM To: Wang, Pin-Chieh Cc: [EMAIL PROTECTED] Subject: Re: regular expression Wang, Pin-Chieh wrote:

RE: Regular expression for an IPv4 address

2002-01-16 Thread Bullock, Howard A.
I am sure one of the experts can make these two regex lines into one, but here it is.. $z = '001.022.003.040'; print "$z\n"; $z =~ s/^0+//; $z =~ s/\.0+/\./g; print "$z\n"; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.c

RE: Regular expression for an IPv4 address

2002-01-16 Thread "Brož Jiří, Ing."
Try for example $ip = join '.',map {int} split /\./,$oldip; or (if you resist on a regular expression) $oldip =~ s/(?:^0+|(\.)0+([1-9]+)|(\.0)00)/$1.$2 || $3/eg; JB -Original Message- From: CARPENTER,STEPHEN (HP-Corvallis,ex1) [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002

RE: Regular expression for an IPv4 address

2002-01-16 Thread Thiebaud Richard
The following: use strict; sub try1; try1 "001.001.001.001"; try1 "1.1.101.1"; try1 "002.2.102.001"; exit(0); sub try1{ my $str = shift; my $str2 = $str; $str2 =~ s/(^|\.)(0*)(\d*)/$1$3/go; print "in: '$str' out: '$str2'\n"; } gives: C:\TEMP>c:\temp\t1.pl in: '0

Re: Regular expression help

2001-12-02 Thread Carl Jolley
On Sat, 1 Dec 2001, linkagent wrote: > - Original Message - > From: "$Bill Luebkert" <[EMAIL PROTECTED]> > To: "linkagent" <[EMAIL PROTECTED]> > > linkagent wrote: > > > I need members help on this; > > > Q1)As far as I know, \d* means match either 0 or more digits, since > > > /(\d*)

Re: Regular expression help

2001-12-01 Thread $Bill Luebkert
linkagent wrote: > > Correct me if I am wrong; > Therefore am I right to say that the matching sequence starts from the back > first (which is not what I read from the books about matching / /). > > i.e in the following match /(\d*)(\d{4})(\d{5})$/ > the regexes look for $ first; > then followe

Re: Regular expression help

2001-12-01 Thread Keith C. Ivey
linkagent <[EMAIL PROTECTED]> wrote: > Correct me if I am wrong; > Therefore am I right to say that the matching sequence starts > from the back first (which is not what I read from the books > about matching / /). No, the matcher starts from the front, but when it fails it backtracks to see if

Re: Regular expression help

2001-12-01 Thread Terry Carroll
On Sat, 1 Dec 2001, linkagent wrote: > - Original Message - > From: "$Bill Luebkert" <[EMAIL PROTECTED]> > To: "linkagent" <[EMAIL PROTECTED]> > > linkagent wrote: > > > I need members help on this; > > > Q1)As far as I know, \d* means match either 0 or more digits, since > > > /(\d*)

Re: Regular expression help

2001-12-01 Thread linkagent
- Original Message - From: "$Bill Luebkert" <[EMAIL PROTECTED]> To: "linkagent" <[EMAIL PROTECTED]> > linkagent wrote: > > I need members help on this; > > Q1)As far as I know, \d* means match either 0 or more digits, since > > /(\d*)/ match 1006326869812 , therefore > > I could not se

Re: Regular expression help

2001-11-30 Thread $Bill Luebkert
linkagent wrote: > - Original Message - > From: "Ron Hartikka" <[EMAIL PROTECTED]> > >>for $number (1006326869812, 563296853235993 , 35968322963568389){ >>print "$1-$2-$3\n" if ($number =~ /(\d*)(\d{4})(\d{5})/); >> > > I need members help on this; > Q1)As far as I know, \d* means m

Re: Regular expression help

2001-11-30 Thread linkagent
- Original Message - From: "Ron Hartikka" <[EMAIL PROTECTED]> > for $number (1006326869812, 563296853235993 , 35968322963568389){ > print "$1-$2-$3\n" if ($number =~ /(\d*)(\d{4})(\d{5})/); I need members help on this; Q1)As far as I know, \d* means match either 0 or more digits, sinc

RE: Regular expression help

2001-11-29 Thread rplane
Thanks to all those who responded Rob -Original Message- From: Plane, Robert Sent: Thursday, November 29, 2001 3:32 PM To: '[EMAIL PROTECTED]' Subject: Regular expression help I need help creating a regular expression to do the following. I have the following numbers: 1006326869812

Re: Regular expression help

2001-11-29 Thread David Kaufman
<[EMAIL PROTECTED]> wrote: > I need help creating a regular expression to do the following. > > I have the following numbers: > > 1006326869812 > 563296853235993 > 35968322963568389 > > and it needs to be broken up like this > > 1006-3268-69812 > 563296-8532-35993 > 35968322-9635-68389 > > Notice

Re: Regular expression help

2001-11-29 Thread Jeffrey
How about something like s/(\d+)(\d{4})(\d{5})/$1-$2-$3/ ? --- [EMAIL PROTECTED] wrote: > I need help creating a regular expression to do the > following. > > I have the following numbers: > > 1006326869812 > 563296853235993 > 35968322963568389 > > and it needs to be broken up like this > > 1

RE: Regular expression help

2001-11-29 Thread Wagner-David
Here is a start: if the needs to numeric and the format stated, then change the s/^(\d+)(\d{4})(\d{5})$/$1-$2-$3/ to if ( s/^(\d+)(\d{4})(\d{5})$/$1-$2-$3/ ) { }else { #error of sometype } #!perl -w while ( ) { chomp; s/^(\d+)(\d{4})(\d

RE: Regular expression help

2001-11-29 Thread Hanson, Robert
You don't even need a regex although you could use one... # untested my $num = 92739874598745; $num =~ /^(\d*)(d{4})(\d{5})$/; my ($n1, $n2, $n3) = ($1, $2, $3); Or you could do this... # untested my $num = 92739874598745; my $n1 = substr($num, 0, length($num) - 9); my $n2 = substr($num, -9, 4

RE: Regular expression help

2001-11-29 Thread Rubinow, Larry
[EMAIL PROTECTED] wrote: > I need help creating a regular expression to do the following. > > I have the following numbers: > > 1006326869812 > 563296853235993 > 35968322963568389 > > and it needs to be broken up like this > > 1006-3268-69812 > 563296-8532-35993 > 35968322-9635-68389 > > Not

  1   2   >