On Sat, 4 Dec 2010 20:32:57 -0800
Gary Kline kl...@thought.org 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
In freebsd-questions Digest, Vol 339, Issue 11, Message: 30
On Sat, 4 Dec 2010 18:23:08 -0800 Gary Kline kl...@thought.org wrote:
On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
Joshua Gimer jgi...@gmail.com wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline
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 kl...@thought.org wrote:
On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
Joshua Gimer jgi...@gmail.com
Joshua == Joshua Gimer jgi...@gmail.com writes:
Joshua On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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 -
Gary == Gary Kline kl...@thought.org 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
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing,
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 between
Quoth RW on Sunday, 05 December 2010:
On Sat, 4 Dec 2010 20:32:57 -0800
Gary Kline kl...@thought.org 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
On Sun, Dec 05, 2010 at 09:37:58AM -0800, Randal L. Schwartz wrote:
Gary == Gary Kline kl...@thought.org 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
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:
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 kl...@thought.org wrote:
On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
Also, the + operator means '1 or more' but needs escaped:
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
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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/
On Sat, Dec 04, 2010 at 05:29:49PM -0700, Joshua Gimer wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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
On Sat, 4 Dec 2010 17:24:30 -0800, Gary Kline kl...@thought.org 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 ] ?
Joshua Gimer jgi...@gmail.com wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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
On Sat, Dec 04, 2010 at 05:56:59PM -0800, per...@pluto.rain.com wrote:
Joshua Gimer jgi...@gmail.com wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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
On Sat, Dec 4, 2010 at 17:56, per...@pluto.rain.com wrote:
Joshua Gimer jgi...@gmail.com wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org 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
On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote:
On Sat, Dec 4, 2010 at 17:56, per...@pluto.rain.com wrote:
Joshua Gimer jgi...@gmail.com wrote:
On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline kl...@thought.org wrote:
I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
Why not just
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/ \d/g;
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 trick, but
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,
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 me:
dog d 1
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,
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,
24 matches
Mail list logo