I'm having difficulties understanding my problem here. If anyone can help, I'll be very thankfull 😉
I would like to find any punctuation between brackets in order to apply a condition on them (via a script). But my grep doesn't work 😕
I thought I could modify another grep expression, the following one, that is looking for everything between brackets. This one works fine and I'm using it a lot.
If I consider using the posix [[:punct:]], why the following expression doesn't work, what should be done in order to fix it ?
Thanks for your insight
Example: (need to get the 2 commas between the brackets, but not the one outside)
Hello Indesign folks (men, women, possibly lost aliens), I need your help.
That is only going to work if there is nothing but punctuation between the parentheses. Can you show us some examples of the actual text you will be searching?
Thanks for you reply.
The overall goal is to use a script that sorts alpha words separated with commas. The script makes it done as long as there aren't any unwilling commas in the sentence, like the one that appear between parentheses.
I'd like write a script that can "neutralise" every commas thar are between the parentheses. The main frame of the script is done, except the Grep expression for finding the commas.
Ex 1: I'd like to be able to
I can easily sort the words :
- Punching, Licking, Throwing
because they are "simply" separated by commas.
Ex2: I cannot use my script yet with the folowwing sentence
- Punching (Boxing, Wing Chun, Karate), Kicking (Kickboxing, Taekwondo, Capoeira, Savate), Throwing (Hapkido, Judo, Sumo, Wrestling, Aikido)
because of the commas appearing between the parentheses.
I'd like to write a grep expression that allows me to select the commas between:
Boxing, Wing / Chun, Karate / Kickboxing, Taekwondo / Taekwondo, Capoeira / Capoeira, Savate / Hapkido, Judo / Judo, Sumo etc.
This way, I could apply a conditional text that will "hide" the commas. I'll then apply my sort script and delete the contion for the whole text to reappear.
That's the one I'm using (see my first post) but selects the whole text between parentheses.
For some reasons (linked to the behavior of the sort script) I need to focus on only looking for the commas.
Try this one...
If you need to select more than just the , use this one and add your punctuations inside the [ ] like so.
Merci Jean-Claude pour ta réponse,
A hell of an grep !
Very close to what I'd like to achieve, but…
The expression reaches every single punctuation (which is already good, something I didn't succeed to) but the thing is, I'd like to reach only the ones between parentheses.
I'm still not much familiar with the \K and \R and wonder what to modifiy to narrow the search between the parentheses
This GREP only select the , when between parentheses.
Have you try it in Find/Change or GREP Style?
I tried with Find/change.
Oh I see, you have more than one group of parantheses... In this case use this:
I knew you were a genius, now, I experience it ^^
Works as a charm. Thank you very much !
… and I have to do my homework in order to understand this quite complex grep expression. There is no way I could have found it by myself.
Thanks again !
Terrific website. Didn't know it at all. Thanks for the tip 😉
Hi @Jean-Claude Tremblay and thanks again for this beautiful grep query you've given us. It works as a charm and we've been using it a lot!
I was wondering whether you (or anyone else, of course) could help me some more about it.
I would like to achieve the same pattern, but with commas between square brackets
I thought it would be easy, just replace the parentheses with the square brackets and I'll be done. I was wrong, obviously.
The following query selects every comma that is between parentheses. Works fine.
That can be tested on some examples like the following paraphrase:
I would like to achieve the same goal, but with square brackets, like on the following paraphrase:
Maison [Garage, etage, box], Appartement [Garage, etage, box], Bungalow [Garage, etage, box]
I've tried different things, even working from the previous version of the query, but couldn't succeed by myself. So here I am again, asking for your input guys
Thanks for your time
Do you mean somthing like that?
Follow the same logic has for ( )
but for some unknown mysteries, it is not working for [ ]
I suspect it’s a bug in InDesign, since like we can see in the image below from regex101, it perfectly working...
It’s definitely a bug in InDesign since it is also working perfectly in BBEdit too.
It works for me as well in InDesign:
I quite InDesign and relaunch it. It’s working fine as expected.
Sure, but I've tried to do the same and thought I failed. With you confirming the right query, I started to wonder why it worked for you and not for me. When JC talked about a bug in ID, I rebooted my computer, read all the replies, and got it working.
So in the end, your input was valuable to me.