• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Select the text after a • but not the •

Engaged ,
Jan 01, 2023 Jan 01, 2023

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();
TOPICS
Scripting

Views

180

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 01, 2023 Jan 01, 2023

It's called "Positive Look Behind"

 

 

 

(?<=•)\\s\\S+\\s\\S+

 

 

 

RobertTkaczyk_0-1672601123606.png

 

RobertTkaczyk_0-1672601206881.png

 

 

Votes

Translate

Translate
Community Expert ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

It's called "Positive Look Behind"

 

 

 

(?<=•)\\s\\S+\\s\\S+

 

 

 

RobertTkaczyk_0-1672601123606.png

 

RobertTkaczyk_0-1672601206881.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

Success! Thank you so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

quote

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+

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

Screenshot submitted later

 

pixxxelschubser_0-1672602489489.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

LATEST

Such a grep should also work without problems - and can be adapted relatively easily to new requirements.

•\K(\h\w+){2}

 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines