Copy link to clipboard
Copied
I'm trying to select the first to words after each • but not include the •. I'm not having any luck. It always selects the • too. Is there any way to do this?
var cStyle = curDoc.characterStyles.item("Style");
var curSel = app.selection[0];
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "•\\s\\S+\\s\\S+";
app.changeGrepPreferences.appliedCharacterStyle = cStyle;
curSel.changeGrep();
It's called "Positive Look Behind"
(?<=•)\\s\\S+\\s\\S+
Copy link to clipboard
Copied
It's called "Positive Look Behind"
(?<=•)\\s\\S+\\s\\S+
Copy link to clipboard
Copied
Success! Thank you so much.
Copy link to clipboard
Copied
I'm trying to select the first to words after each • but not include the •
…
By @davidn5918184
Do you perhaps mean: "I try to select the first two words after each •" …
And one more question: These "•" are not automatically bullet points - right?
Please show a screenshot with visible hidden characters.
Normally, greps like the following should work in most cases:
•(\t|\h)\K\w+\h\w+
Copy link to clipboard
Copied
Screenshot submitted later
Copy link to clipboard
Copied
Such a grep should also work without problems - and can be adapted relatively easily to new requirements.
•\K(\h\w+){2}
😉