[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp Functions
From: |
Freeman Gilmore |
Subject: |
Re: Regexp Functions |
Date: |
Tue, 9 Jun 2020 03:42:13 -0400 |
On Mon, Jun 8, 2020 at 4:31 PM Aaron Hill <lilypond@hillvisions.com> wrote:
>
> On 2020-06-08 12:47 pm, Caio Barros wrote:
> > Hello!
> >
> > Em seg., 8 de jun. de 2020 às 08:37, Freeman Gilmore <
> > freeman.gilmore@gmail.com> escreveu:
> >
> >> If the string is "A ... B ... " , using Regexp Functions is it
> >> possible, if 'A' matches [-] then 'B' would be replaced by "C"? 'A'
> >> is first in the string. Position of B is not constant.and may not be
> >> there.
> >>
> >
> > Can you provide a little more context of what you are trying to do and
> > what
> > this has to to with lilypond? What tools are you using to find and
> > replace
> > strings using regex?
>
> LilyPond -> Guile -> (use-modules (ice-9 regex))
>
> Or I could be making the wrong assumption here. ¯\_(ツ)_/¯
>
> ;;;;
> (display
> (regexp-substitute/global #f
> (make-regexp "(^A.*)B" regexp/newline)
> (string-join '("A ... B ..." "D ... B ..."
> "A ... E ..." "A ... B ...")
> "\n" 'suffix)
> 'pre 1 "C" 'post))
> ;;;;
>
> ====
> A ... C ...
> D ... B ...
> A ... E ...
> A ... C ...
> ====
>
> The key here is to use a capturing group for the portion of the string
> before "B" that you need to preserve in the substitution.
I do no tthink this is what i want. Let me try again Say you have
"Xsdfghjkl" If "x" is the first
character then replace the "g" if it exist with "Y" => "XsdYfhjkl"X
Thank you,ƒg
>
>
> -- Aaron Hill
>
- Re: Regexp Functions, (continued)
- Re: Regexp Functions, Michael Gerdau, 2020/06/09
- Re: Regexp Functions, Freeman Gilmore, 2020/06/09
- Re: Regexp Functions, Jacques Menu, 2020/06/09
- Re: Regexp Functions, Freeman Gilmore, 2020/06/09
- Re: Regexp Functions, Jacques Menu, 2020/06/09
- Re: Regexp Functions, Freeman Gilmore, 2020/06/09
- Re: Regexp Functions, Phil Holmes, 2020/06/09
- Re: Regexp Functions, Freeman Gilmore, 2020/06/09
- Re: Regexp Functions, Michael Gerdau, 2020/06/09
- Re: Regexp Functions, Aaron Hill, 2020/06/09
- Re: Regexp Functions,
Freeman Gilmore <=
- Re: Regexp Functions, Aaron Hill, 2020/06/09
- Re: Regexp Functions, Freeman Gilmore, 2020/06/15
- Re: Regexp Functions, Aaron Hill, 2020/06/15
- Re: Regexp Functions, Freeman Gilmore, 2020/06/16
- Re: Regexp Functions, Aaron Hill, 2020/06/16
- Re: Regexp Functions, Freeman Gilmore, 2020/06/16
- Re: Regexp Functions, Freeman Gilmore, 2020/06/20