From: Slava Akhmechet
Subject: A string-replace?
Date: 
Message-ID: <87zm3e460l.fsf@gmail.com>
I'm looking for a string-replace function that would behave similarly
to cl-ppcre:regex-replace, only without the regex. Is there a good
library that does this? Alternatively, is there a good way to escape
regular expressions so they would be treated as strings by ppcre (the
strings will be entered by users)?

-- 
Regards,
Slava Akhmechet.

From: vy
Subject: Re: A string-replace?
Date: 
Message-ID: <1181070162.903993.151640@n4g2000hsb.googlegroups.com>
On Jun 5, 9:20 pm, Slava Akhmechet <·········@gmail.com> wrote:
> I'm looking for a string-replace function that would behave similarly
> to cl-ppcre:regex-replace, only without the regex. Is there a good
> library that does this? Alternatively, is there a good way to escape
> regular expressions so they would be treated as strings by ppcre (the
> strings will be entered by users)?

You can write a wrapper around REGEX-REPLACE, that escapes its input
for some certain regular expression characters and then makes a call
to REGEX-REPLACE.
From: Edi Weitz
Subject: Re: A string-replace?
Date: 
Message-ID: <umyzeuspm.fsf@agharta.de>
On Tue, 05 Jun 2007 18:20:57 GMT, Slava Akhmechet <·········@gmail.com> wrote:

> Alternatively, is there a good way to escape regular expressions so
> they would be treated as strings by ppcre (the strings will be
> entered by users)?

  http://weitz.de/cl-ppcre/#quote-meta-chars

Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Pascal Bourguignon
Subject: Re: A string-replace?
Date: 
Message-ID: <87zm3erpch.fsf@thalassa.lan.informatimago.com>
Slava Akhmechet <·········@gmail.com> writes:

> I'm looking for a string-replace function that would behave similarly
> to cl-ppcre:regex-replace, only without the regex. Is there a good
> library that does this? Alternatively, is there a good way to escape
> regular expressions so they would be treated as strings by ppcre (the
> strings will be entered by users)?

What about: http://darcs.informatimago.com/lisp/common-lisp/string.lisp


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
From: fireblade
Subject: Re: A string-replace?
Date: 
Message-ID: <1181217383.691482.172500@k79g2000hse.googlegroups.com>
On Jun 6, 12:47 am, Pascal Bourguignon <····@informatimago.com> wrote:
> Slava Akhmechet <·········@gmail.com> writes:
> > I'm looking for a string-replace function that would behave similarly
> > to cl-ppcre:regex-replace, only without the regex. Is there a good
> > library that does this? Alternatively, is there a good way to escape
> > regular expressions so they would be treated as strings by ppcre (the
> > strings will be entered by users)?
>
> What about:http://darcs.informatimago.com/lisp/common-lisp/string.lisp
>
> --
> __Pascal Bourguignon__                    http://www.informatimago.com/
>
> NOTE: The most fundamental particles in this product are held
> together by a "gluing" force about which little is currently known
> and whose adhesive power can therefore not be permanently
> guaranteed.

Nice code , too bad it's under GPL.
From: Pascal Bourguignon
Subject: Re: A string-replace?
Date: 
Message-ID: <87bqfrsqoh.fsf@thalassa.lan.informatimago.com>
fireblade <·················@gmail.com> writes:

> On Jun 6, 12:47 am, Pascal Bourguignon <····@informatimago.com> wrote:
>> Slava Akhmechet <·········@gmail.com> writes:
>> > I'm looking for a string-replace function that would behave similarly
>> > to cl-ppcre:regex-replace, only without the regex. Is there a good
>> > library that does this? Alternatively, is there a good way to escape
>> > regular expressions so they would be treated as strings by ppcre (the
>> > strings will be entered by users)?
>>
>> What about:http://darcs.informatimago.com/lisp/common-lisp/string.lisp
>
> Nice code , too bad it's under GPL.

I sell commercial licenses too.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
From: ··········@hotmail.com
Subject: Re: A string-replace?
Date: 
Message-ID: <1181206451.366601.154700@m36g2000hse.googlegroups.com>
http://cl-cookbook.sourceforge.net/strings.html
From: Thomas Bakketun
Subject: Re: A string-replace?
Date: 
Message-ID: <5cp1crF2vfmbrU1@mid.individual.net>
Slava Akhmechet wrote:

> Alternatively, is there a good way to escape
> regular expressions so they would be treated as strings by ppcre (the
> strings will be entered by users)?

(defun string-replace (new old string)
   (cl-ppcre:regex-replace-all `(:group ,old) string new))

See documentation on parse-trees:
http://weitz.de/cl-ppcre/#create-scanner2