Re: Regex question

2021-02-12 Thread Christopher Stone
On 02/12/2021, at 06:07, @lbutlr mailto:krem...@kreme.com>> wrote: > > I seem to be having a Brain Cloud¹ moment, but I am trying to match a pattern > like this: > > foo+(anything)# or foo# and NOT match > > foobar# > foobar+(anything)# > foob# > foob+(anything)# > etc > > foo+# is invalid

Re: Regex question

2021-02-12 Thread Neil Faiman
That looks like foo(\+.*?)?# (Using .*? instead of .* ensures that if you have a line like "foo+bar# foo+mung#", it will match two occurrences, "foo+bar#" and "foo+mung#", rather than a single occurrence with foo followed by the string "bar# foo+mung" followed by #. Regards,

Regex question

2021-02-12 Thread @lbutlr
I seem to be having a Brain Cloud¹ moment, but I am trying to match a pattern like this: foo+(anything)# or foo# and NOT match foobar# foobar+(anything)# foob# foob+(anything)# etc foo+# is invalid and cannot occur in my dataset. Basically, the + is optional, but if it is there, I have to

Re: Tricky regex question

2019-02-02 Thread jgill
This one seem to work for me (In BBEdit anyway). With this framework, I can add the more exotic chords if necessary. Thanks (to everyone). On Saturday, February 2, 2019 at 6:40:56 PM UTC, ThePorgie wrote: > > Fiddle with for a bit...Notice in the thread MPasini had a pattern that > worked on

Re: Tricky regex question

2019-02-02 Thread Marek Stepanek
^\s*([A-Z\dm♭#bdimsu]+\s+)+ Good night folx ps: how to put “dim” or “sus" into a character class as a string? > On 2. Feb 2019, at 19:56, bruce linde wrote: > > yes, but… what about Eb7#9 or C#7#9 or A9sus? -- This is the BBEdit Talk public discussion group. If you have a feature

Re: Tricky regex question

2019-02-02 Thread bruce linde
yes, but… what about Eb7#9 or C#7#9 or A9sus? you’re assuming missionary position chords and not (for example) steely dan or jazz. i am still not sure what the goal is… put the chords in bold, but not the lyrics? create a ‘chords only’ version for the non-singers in the band? you said you

Re: Tricky regex question

2019-02-02 Thread Marek Stepanek
So try this: ^\s*([A-Z\dm♭#dim]+\s+)+ it’s working on this example: E B7 E A Am E This is a line of a song E This is a line of a song B7 E E7 This is a line of a song A This is a line of a song E This is a line of a song

Re: Tricky regex question

2019-02-02 Thread bruce linde
actually, you don’t. you need to identify one or the other…. if you match one, it ain’t the other and you can format accordingly. > On Feb 2, 2019, at 9:45 AM, jgill > wrote: > > I need to identify chord lines and non-chord lines so that I can style

Re: Tricky regex question

2019-02-02 Thread Mike Pasini
On Saturday, February 2, 2019 at 9:45:40 AM UTC-8, jgill wrote: > > I need to identify chord lines and non-chord lines so that I can style > them differently on a web page. Remember, I'm not just looking for [A-G] > but A7, Am, A#, A♭dim etc > > Yep, it's tricky. This

Re: Tricky regex question

2019-02-02 Thread jgill
I need to identify chord lines and non-chord lines so that I can style them differently on a web page. Remember, I'm not just looking for [A-G] but A7, Am, A#, A♭dim etc On Saturday, February 2, 2019 at 5:36:42 PM UTC, Marek wrote: > > Hello jgill! > > > You forgot to tell us, what you exactly

Re: Tricky regex question

2019-02-02 Thread David Rostenne
Hmm. What about removing the lines of the song instead? I’m sure an Applescript, awk or some other script can remove every second line, or just copy it to a new file, and then you won’t need to mess with regex’s.

Tricky regex question

2019-02-02 Thread jgill
I've been banging my head all afternoon trying to derive a regex the will identify lines (of a song) that contains chords. eg E B7 E A Am E This is a line of a song E This is a line of a song B7 E E7 This is a line of a song A This is a line of a

Re: Regex Question

2015-08-24 Thread Oliver Taylor
Holger, When I need to figure out a regex pattern I have a rough idea of, but want to refine, tools like the one linked below are vital. https://regex101.com/ On Aug 23, 2015, at 8:10 PM, 'Holger B' via BBEdit Talk bbedit@googlegroups.com wrote: Hi Alex, this is actually quite a

Re: Regex Question

2015-08-24 Thread 'Holger B' via BBEdit Talk
Thanks Oliver, this is a great tool, like it a lot. Less comprehensive but also nice is http://www.regexr.com/. Cheers, Holger On 24/08/2015 at 15:32:18 HKT m...@olivertaylor.net wrote: Holger, When I need to figure out a regex pattern I have a rough idea of, but want to refine, tools like

Re: Regex Question

2015-08-24 Thread 'Holger B' via BBEdit Talk
On 24/08/2015 at 17:39:08 HKT listmeis...@suddenlink.net wrote: Essentially you're wanting to find a variable string, massage that string a fair amount into its final form, and replace it. The less regular the string is the more difficult it is to manage with a single-pass regex find/replace.

Re: Regex Question

2015-08-24 Thread Christopher Stone
On Aug 24, 2015, at 05:28, 'Holger B' via BBEdit Talk bbedit@googlegroups.com wrote: And in that case, text factories FTW ;) __ Hey Holger, Scripts tend to be faster than text factories. -- Best Regards, Chris -- This is

Re: Regex Question

2015-08-24 Thread Christopher Stone
On Aug 23, 2015, at 22:00, 'Holger B' via BBEdit Talk bbedit@googlegroups.com wrote: See a portion of the file below. The amount of categories as well as tags are the ones that can vary and getting it in one pass could replace both of them. I suppose it's not possible in one pass though, but

Re: Regex Question

2015-08-23 Thread Alex Satrapa
Would it be sufficient to replace s/\n\s+-/,/ — This would make categories: - A - B - C Turn into: categories:, A, B, C Then a second pass to remove the first comma s/:,/:/ categories: A, B, C Alex On 23 Aug 2015, at 03:56, 'Holger B' via BBEdit Talk

Re: Regex Question

2015-08-23 Thread 'Holger B' via BBEdit Talk
Hi Alex, this is actually quite a good approach. It doesn't solve it in one pass, but thinking to start at the end of the line (\r) seems to be a good idea which I somehow didn't think of before. I tried this: \n\s+-\s?(.+)$ and replace with: \1, which results in categories:A, B, C, Seems

Re: Regex Question

2015-08-23 Thread 'Holger B' via BBEdit Talk
Hi Patrick, see a portion of the file below. The amount of categories as well as tags are the ones that can vary and getting it in one pass could replace both of them. I suppose it's not possible in one pass though, but am curious if I'm missing something. --- title: Newsletter Design

Re: Regex Question

2015-08-22 Thread Patrick Woolsey
Can you please supply a small section of the actual data (if possible), since though notionally I expect this shouldn't take more than two passes, that may not hold up. :) Regards, Patrick Woolsey == Bare Bones Software, Inc. http://www.barebones.com/ On 8/23/15 at 1:56 PM,

Regex Question

2015-08-22 Thread 'Holger B' via BBEdit Talk
Hi, I know there's some very talented regex people on this list, so after unsuccessfully trying to solve this, I'm giving it a shot here. I'm trying to achieve the following search/replace and am not sure if it's even possible in one pass. I believe the solution would be to find an unknown

Re: Regex Question

2015-08-22 Thread Kerri Hicks
I'm not sure I understand your use case fully, but if I do, you can just grep search ^- (.*?)\r and replace with \1, Hope this helps, --Kerri On Sat, Aug 22, 2015 at 1:56 PM, 'Holger B' via BBEdit Talk bbedit@googlegroups.com wrote: Hi, I know there's some very talented regex people on