On Fri, Mar 13, 2009 at 1:19 AM, ChrisK hask...@list.mightyreason.com wrote:
At the cost of writing your own routine you get exactly what you want in a
screen or less of code, see
http://hackage.haskell.org/packages/archive/regex-compat/0.92/doc/html/src/Text-Regex.html#subRegex
for
2009/3/16 ChrisK hask...@list.mightyreason.com:
Let me open the discussion with all the questions I can quickly ask:
What should the subRegex function do, exactly?
(Single replacement,global replacement,once per line,...)
Try to do the same thing as =~ s/../../ in perl.
For a version 1:
Thomas Hartman wrote:
testPcre = ( subRegex (mkRegex (?!\n)\n(?!\n)) asdf\n \n\n\nadsf
) == asdf \n\n\nadsf
quoting from the man page for regcomp:
REG_NEWLINE Compile for newline-sensitive matching. By default, newline is a
completely ordinary character with
no special
Thomas Hartman wrote:
testPcre = ( subRegex (mkRegex (?!\n)\n(?!\n)) asdf\n \n\n\nadsf
) == asdf \n\n\nadsf
quoting from the man page for regcomp:
REG_NEWLINE Compile for newline-sensitive matching. By default, newline is a
completely ordinary character with
no special
Thanks, that was extremely helpful.
My bad for being so sloppy reading the documentation so sloppily -- I
somehow glossed over the bit that backreferences worked as one would
expect.
To atone for this,
http://patch-tag.com/repo/haskell-learning/browse/regexStuff/pcreReplace.hs
shows successful
Don Stewart wrote:
tphyahoo:
Is there something like subRegex... something like =~ s/.../.../ in
perl... for haskell pcre Regexen?
I mean, subRegex from Text.Regex of course:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-compat
Thanks for any advice,
Basically, we should
Except that there is nothing like =~ s in haskell, as far as I can tell.
I was mulling over this and thinking, the nicest solution for this --
from the lens of perl evangelism anyway -- would be to have some way
of accessing the perl6 language =~ s mechanism in pugs, which would
get us everything
So, I tweaked Text.Regex to have the behavior I need.
http://patch-tag.com/repo/haskell-learning/browse/regexStuff/pcreReplace.hs
FWIW, the problem I was trying to solve was deleting single newlines
but not strings of newlines in a document. Dead simple for pcre-regex
with lookaround. But, I
Also, consider stealing the regex susbt code from:
http://shootout.alioth.debian.org/u64q/benchmark.php?test=regexdnalang=ghcid=4
tphyahoo:
So, I tweaked Text.Regex to have the behavior I need.
http://patch-tag.com/repo/haskell-learning/browse/regexStuff/pcreReplace.hs
FWIW, the
On 2009 Mar 14, at 19:01, Thomas Hartman wrote:
FWIW, the problem I was trying to solve was deleting single newlines
but not strings of newlines in a document. Dead simple for pcre-regex
with lookaround. But, I think, impossible with posix regex.
s/(^|[^\n])\n($|[^\n])/\1\2/g;
POSIX regexen
Thomas Hartman wrote:
Is there something like subRegex... something like =~ s/.../.../ in
perl... for haskell pcre Regexen?
I mean, subRegex from Text.Regex of course:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regex-compat
Thanks for any advice,
thomas.
Short answer: No.
11 matches
Mail list logo