Re: Help with a regex

2012-12-22 Thread Dr.Ruud
On 2012-12-22 10:46, Feng He wrote: You probably had $string double quoted instead of single quoted which later results in the \ being eaten. Thank you. The people who said the problem of double quoted string are correct, I didn't know this item before. This is what I really want: use s

Re: Help with a regex

2012-12-22 Thread Feng He
> > You probably had $string double quoted instead of > single quoted which later results in the \ being eaten. > Thank you. The people who said the problem of double quoted string are correct, I didn't know this item before. This is what I really want: use strict; my $email1 = restore_email

Re: Help with a regex

2012-12-21 Thread Charles DeRykus
On Thu, Dec 20, 2012 at 11:39 PM, Feng He wrote: > Hello, > > I have a string like: dns\.support.dnsbed.com > I want to translate it to a regular email address: dns.supp...@dnsbed.com > > > if ($string =~ /^(.*?)(? my $user = $1; > my $tld = $2; > return $user . '@'. $t

Re: Help with a regex

2012-12-21 Thread timothy adigun
Hi, On Fri, Dec 21, 2012 at 8:39 AM, Feng He wrote: > Hello, > > I have a string like: dns\.support.dnsbed.com > I want to translate it to a regular email address: dns.supp...@dnsbed.com > > > if ($string =~ /^(.*?)(? my $user = $1; > my $tld = $2; > return $user . '@

Re: Help with a regex

2012-12-21 Thread *Shaji Kalidasan*
Shaji Kalidasan* To: Feng He Cc: "beginners@perl.org" Sent: Friday, 21 December 2012 3:55 PM Subject: Re: Help with a regex Greetings, IMHO, Here is one way to do it. Again there could be better ways to solve this one. while () {     if(/         ([\w.]+)  #Match foo.bar | jack.f

Re: Help with a regex

2012-12-21 Thread *Shaji Kalidasan*
it is your gift back to God. --- From: Feng He To: *Shaji Kalidasan* Cc: "beginners@perl.org" Sent: Friday, 21 December 2012 3:31 PM Subject: Re: Help with a regex  The ema

Re: Help with a regex

2012-12-21 Thread *Shaji Kalidasan*
ift back to God. --- From: Guoke Zhou (Wicresoft) To: Feng He Cc: "beginners@perl.org" Sent: Friday, 21 December 2012 2:01 PM Subject: RE: Help with a regex $string='dns\.support.dnsbed.com'

RE: Help with a regex

2012-12-21 Thread Guoke Zhou (Wicresoft)
$string='dns\.support.dnsbed.com'; print "$string\n"; if ($string =~ /^(.*?)\\\.(.*?)(?mailto:fen...@nsbeta.info] Sent: Friday, December 21, 2012 3:39 PM To: beginners@perl.org Subject: Help with a regex Hello, I have a string like: dns\.support.dnsbed.com I want to translate it to a regular

Re: help with a regex

2009-07-18 Thread Dan Wallis
2009/7/18 Jenn G. : > next if /\/0$|^127\./; > > ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1 > it will be next.) When you say, "it will be next" it sounds like you want it to be processed. The next keyword stops this loop iteration short, and continues at the next iterati

Re: help with a regex

2009-07-17 Thread John W. Krahn
Jenn G. wrote: Hello, Hello, I'm not sure if the syntax below is correct: next if /\/0$|^127\./; ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1 it will be next.) Or do I need to use () to enclose the char at both sides of the "|" ? next if /(\/0$)|(^127\.)/; No,

Re: help with a regex and greediness

2004-03-14 Thread Stuart White
--- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Stuart White wrote: > I don't think so: > ... > The only place a colon split splits is where you > have a colon. > That was MY typo. Oops. In the book there is a colon after merlyn, not a question mark. Irrespective of that, I was still

Re: help with a regex and greediness

2004-03-14 Thread Stuart White
--- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Stuart White wrote: > > > > the file format is not sloppy at all. I was just > > confused as to why I couldn't use split on the > first > > space score comma and space, and then the next > space > > score. <-Perhaps I just answered my questio

Re: help with a regex and greediness

2004-03-13 Thread R. Joseph Newton
Stuart White wrote: > the file format is not sloppy at all. I was just > confused as to why I couldn't use split on the first > space score comma and space, and then the next space > score. <-Perhaps I just answered my question right > there, seeing that in the second iteration, there is > no c

Re: help with a regex and greediness

2004-03-13 Thread R. Joseph Newton
Stuart White wrote: > $line = > "merlyn::118:10:Randal:/home/merlyn?/usr/bin/perl"; > @fields = s;oit(/:/,$line); > #now @fields is ("merlyn:, > "","118","10","Randal","/home/merlyn","/usr/bin/perl") I don't think so: Greetings! E:\d_drive\perlStuff>perl -w $line = "merlyn::118:10:Randal:/ho

Re: help with a regex and greediness

2004-03-13 Thread Stuart White
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > > Stuart White said: > > > I'm not sure what's going wrong here. Can someone > > tell me how I can split 'Spurs 94, Suns 82' into: > > array[0] == 'Spurs' and array[1] == 'Suns' > > @array = /([[:alpha:]]+)/g; > This did what I wanted it to do, t

Re: help with a regex and greediness

2004-03-13 Thread Stuart White
--- "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Stuart White wrote: > > > Wow, yeah that helps a lot. > > Here's a question: If if had: > > $line = 'Spurs 94, Suns 82, Heat 99, Magic 74' > > and then did a split on comma and comma's > surrounding > > spaces: > > @result = split (/\s*,\s*/, $

Re: help with a regex and greediness

2004-03-12 Thread R. Joseph Newton
Stuart White wrote: > Wow, yeah that helps a lot. > Here's a question: If if had: > $line = 'Spurs 94, Suns 82, Heat 99, Magic 74' > and then did a split on comma and comma's surrounding > spaces: > @result = split (/\s*,\s*/, $line); result? How specific is "result" to the issue at hand? Woul

Re: help with a regex and greediness

2004-03-12 Thread Stuart White
--- "Randy W. Sims" <[EMAIL PROTECTED]> wrote: > On 03/12/04 08:18, Stuart White wrote: > > I like the idea of using split() but decided to > keep > > most of my regex and incorporate split on the > string. > > So the string: 'Spurs 94, Suns 82' <-and there may > or > > may not be a space after th

Re: help with a regex and greediness

2004-03-12 Thread Randy W. Sims
On 03/12/04 08:18, Stuart White wrote: I like the idea of using split() but decided to keep most of my regex and incorporate split on the string. So the string: 'Spurs 94, Suns 82' <-and there may or may not be a space after the 2. I decided to read up on split(), and then try to split it. The spli

Re: help with a regex and greediness

2004-03-12 Thread Paul Johnson
Stuart White said: > I'm not sure what's going wrong here. Can someone > tell me how I can split 'Spurs 94, Suns 82' into: > array[0] == 'Spurs' and array[1] == 'Suns' @array = /([[:alpha:]]+)/g; -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROT

Re: help with a regex and greediness

2004-03-12 Thread Stuart White
I like the idea of using split() but decided to keep most of my regex and incorporate split on the string. So the string: 'Spurs 94, Suns 82' <-and there may or may not be a space after the 2. I decided to read up on split(), and then try to split it. This is what I came up with: @teamscores = spl

Re: help with a regex and greediness

2004-03-11 Thread Stuart White
Oops, it just looked like you were testing a literal. My mistake, I'll check it out. --- "Randy W. Sims" <[EMAIL PROTECTED]> wrote: > On 3/11/2004 10:28 PM, Stuart White wrote: > > > --- "Randy W. Sims" <[EMAIL PROTECTED]> > > wrote: > > > >>On 3/11/2004 9:01 PM, Stuart White wrote: > >> > >>

Re: help with a regex and greediness

2004-03-11 Thread Randy W. Sims
On 3/11/2004 10:28 PM, Stuart White wrote: --- "Randy W. Sims" <[EMAIL PROTECTED]> wrote: On 3/11/2004 9:01 PM, Stuart White wrote: I'm confused about greediness. This is the line that I'm trying to match: Spurs 94, Suns 82 If the line is as above, I probably wouldn't use a regex. The following

Re: help with a regex and greediness

2004-03-11 Thread Stuart White
--- "Randy W. Sims" <[EMAIL PROTECTED]> wrote: > On 3/11/2004 9:01 PM, Stuart White wrote: > > > I'm confused about greediness. > > This is the line that I'm trying to match: > > > > Spurs 94, Suns 82 > > If the line is as above, I probably wouldn't use a > regex. The following > is more verbo

Re: help with a regex and greediness

2004-03-11 Thread Randy W. Sims
On 3/11/2004 9:01 PM, Stuart White wrote: I'm confused about greediness. This is the line that I'm trying to match: Spurs 94, Suns 82 If the line is as above, I probably wouldn't use a regex. The following is more verbose, but easier to manage IMHO. #!/usr/bin/perl use strict; use warnings; my