[Haskell-cafe] Re: Has anybody replicated =~ s/../../ or even
something more basic for doing replacements with pcre haskell regexen?
Thomas Hartman
tphyahoo at gmail.com
Sun Mar 15 20:00:33 EDT 2009
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 in perl 5 =~, and also all the cool grammar stuff
that comes in perl6, which seems 90% of the way to parsec in terms of
power but with a thought out huffman-optimized syntax.
Accordingly I am trying to load pugs in ghci, about which more at
http://perlmonks.org/?node_id=750768
2009/3/14 Brandon S. Allbery KF8NH <allbery at ece.cmu.edu>:
> 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 may be ugly, but they're capable.
>
> --
> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university KF8NH
>
>
>
More information about the Haskell-Cafe
mailing list