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

Using grep to find and style "any white space followed by =, < or >"

Explorer ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Hi all,

I am trying to use grep in a paragraph style to automatically italicise p numbers. (mentions of p = 0.001, p > 0.0001)

Basically, I need to style every time there is a p followed by any white space followed by either =,< or >.

So far I can get it to work without the white spaces using: p(?=[\=]|[\r>]|[\r<]) which will style mentions of p= 0.001, p> 0.0001.

Where I am struggling is how to add in the any white space.

I have tried adding in in \s but wherever I put this it adds the italic style to everywhere there is p then white space, even if this is at the end of a word.

Any suggestions?

Views

408

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

Guide , May 23, 2018 May 23, 2018

Find:  p\h?(?=[=<>])

Replace by:  p~s + italic

Best,

Michel, from FRIdNGE

Votes

Translate

Translate
Community Expert ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Try (?<=[\p\s])[\=|\<|\>]

I just put brackets around the p and space in the positive look behind.

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
Explorer ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Thanks for the suggestion,

I have just tried using (?<=[\p\s])[\=|\<|\>] and it does not seem to pick anything up in my styles

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
Guide ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

Find:  p\h?(?=[=<>])

Replace by:  p~s + italic

Best,

Michel, from FRIdNGE

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
Explorer ,
May 23, 2018 May 23, 2018

Copy link to clipboard

Copied

LATEST

Yes that works! Thank you.

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