On Sun, 2010-12-05 at 10:19 -0800, Chip Camden wrote:
> Quoth RW on Sunday, 05 December 2010:
> > On Sat, 4 Dec 2010 20:32:57 -0800
> > Gary Kline wrote:
> >
> > > On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
> >
> > > > Also, the + operator means '1 or more' but needs escaped:
> > >
On Sun, Dec 05, 2010 at 10:11:34AM -0800, Chip Camden wrote:
> Quoth Polytropon on Sunday, 05 December 2010:
> >
> >
> > > PS: See, this is why I keep cheatsheets. ;)
> >
> > That's the fat green book on my shelf. :-)
> >
>
> For regex reference, I find this site helpful:
> http://www.regul
On Sun, Dec 05, 2010 at 09:37:58AM -0800, Randal L. Schwartz wrote:
> > "Gary" == Gary Kline writes:
>
> Gary> %s/[1-0][0-9]*/foo/g
>
> Except 1-0 is an empty set. :)
>
Ya, sure, you-betcha! I really did mean a '9'there. For some
reason, what I'm thinking sometime
Quoth RW on Sunday, 05 December 2010:
> On Sat, 4 Dec 2010 20:32:57 -0800
> Gary Kline wrote:
>
> > On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
>
> > > Also, the + operator means '1 or more' but needs escaped:
> > > %s/[0-9]\+/foo/g
> >
> >
> > Okay. I thought that the + must
Quoth Polytropon on Sunday, 05 December 2010:
>
>
> > PS: See, this is why I keep cheatsheets. ;)
>
> That's the fat green book on my shelf. :-)
>
For regex reference, I find this site helpful:
http://www.regular-expressions.info/reference.html
... especially regarding differences betwee
> "Gary" == Gary Kline writes:
Gary> %s/[1-0][0-9]*/foo/g
Except 1-0 is an empty set. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://meth
> "Joshua" == Joshua Gimer writes:
Joshua> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
>> I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
Joshua> Why not just %s/[0-9]*/foo/g
Because that would turn a line of "fred" into "foofred". :)
--
Randal L. Schwartz - Stonehenge Consulting Servic
On Sun, Dec 05, 2010 at 07:56:30PM +1100, Ian Smith wrote:
> In freebsd-questions Digest, Vol 339, Issue 11, Message: 30
> On Sat, 4 Dec 2010 18:23:08 -0800 Gary Kline wrote:
> > On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
> > > Joshua Gimer wrote:
> > >
> > > > On
In freebsd-questions Digest, Vol 339, Issue 11, Message: 30
On Sat, 4 Dec 2010 18:23:08 -0800 Gary Kline wrote:
> On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
> > Joshua Gimer wrote:
> >
> > > On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
> > > > I have tried
On Sat, 4 Dec 2010 20:32:57 -0800
Gary Kline wrote:
> On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
> > Also, the + operator means '1 or more' but needs escaped:
> > %s/[0-9]\+/foo/g
>
>
> Okay. I thought that the + must be perl-only regex... .
It's from "Extended" REs rath
On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
> On Sat, Dec 4, 2010 at 17:56, wrote:
> > Joshua Gimer wrote:
> >
> >> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
> >> > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
> >> Why not just %s/[0-9]*/foo/g
> >
> > Too broad -- it will mat
On Sat, Dec 4, 2010 at 17:56, wrote:
> Joshua Gimer wrote:
>
>> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
>> > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
>> Why not just %s/[0-9]*/foo/g
>
> Too broad -- it will match the null string. (* means "zero or more
> instances of" whatever prec
On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
> Joshua Gimer wrote:
>
> > On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
> > > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
> > Why not just %s/[0-9]*/foo/g
>
> Too broad -- it will match the null string. (* means "zero
Joshua Gimer wrote:
> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
> > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
> Why not just %s/[0-9]*/foo/g
Too broad -- it will match the null string. (* means "zero or more
instances of" whatever preceded it.)
Best RE I know for integers is
[1-9]
On Sat, 4 Dec 2010 17:24:30 -0800, Gary Kline wrote:
> So I just missed the "*"?
Yes. In regex, * means "any amount of", if I remember correctly.
So you don't have to specify precisely how many numbers there
are.
How many lights? :-)
> Didn't need to escape the [ or ] ?
No, as you wan
On Sat, Dec 04, 2010 at 05:29:49PM -0700, Joshua Gimer wrote:
> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
>
> > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
>
> Why not just %s/[0-9]*/foo/g
>
So I just missed the "*"? Didn't need to escape the [ or ] ?
---I'll give it a
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline wrote:
> I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
Why not just %s/[0-9]*/foo/g
--
Thanks,
Joshua Gimer
---
http://www.linkedin.com/in/jgimer
http://twitter.com/jgimer
http://itsecops.blogspot.com/
__
Gang,
I was tried to find Jeffrey Friedl's email to figure out some quick
regex when it struck me that the list can clue me in [[I have
figured this out myself several times--well, 3 or 4 anyway--but it
was more trial/error than I need.]]
I have a file with ints from 0 to some N. What is th
On Thu, 28 Aug 2003, Roger Williams wrote:
> I know thins is not the place but I know one of you know this one off the
> top of your head.
>
> I have:
>
> $list = "dog 1 1 1 cat 2 1 snake 111"
> and I want to end up with:
> dog 1 cat 2 snake 1
> I thought
> $list =~ s/ \d \d/ \d/g;
> would do the
On Thu, Aug 28, 2003 at 08:26:43AM +0900, Roger Williams wrote:
> I know thins is not the place but I know one of you know this one off the
> top of your head.
>
> I have:
>
> $list = "dog 1 1 1 cat 2 1 snake 111"
> and I want to end up with:
> dog 1 cat 2 snake 1
> I thought
> $list =~ s/ \d \d/
I know thins is not the place but I know one of you know this one off the
top of your head.
I have:
$list = "dog 1 1 1 cat 2 1 snake 111"
and I want to end up with:
dog 1 cat 2 snake 1
I thought
$list =~ s/ \d \d/ \d/g;
would do the trick, but that gives me:
dog d 1 1 cat d snake d 1
Thanks,
Rog
I know thins is not the place but I know one of you know this one off the
top of your head.
I have:
$list = "dog 1 1 1 cat 2 1 snake 111"
and I want to end up with:
dog 1 cat 2 snake 1
I thought
$list =~ s/ \d \d/ \d/g;
would do the trick, but that gives me:
dog d 1 1 cat d snake d 1
Thanks,
Rog
Roger Williams wrote:
> I know thins is not the place but I know one of you know this one off the
> top of your head.
>
> I have:
>
> $list = "dog 1 1 1 cat 2 1 snake 111"
> and I want to end up with:
> dog 1 cat 2 snake 1
> I thought
> $list =~ s/ \d \d/ \d/g;
> would do the trick, but that gives
I know thins is not the place but I know one of you know this one off the
top of your head.
I have:
$list = "dog 1 1 1 cat 2 1 snake 111"
and I want to end up with:
dog 1 cat 2 snake 1
I thought
$list =~ s/ \d \d/ \d/g;
would do the trick, but that gives me:
dog d 1 1 cat d snake d 1
Thanks,
Rog
24 matches
Mail list logo