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.
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.
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")
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.
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.
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.
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