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?
Find: p\h?(?=[=<>])
Replace by: p~s + italic
Best,
Michel, from FRIdNGE
Copy link to clipboard
Copied
Try (?<=[\p\s])[\=|\<|\>]
I just put brackets around the p and space in the positive look behind.
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
Copy link to clipboard
Copied
Find: p\h?(?=[=<>])
Replace by: p~s + italic
Best,
Michel, from FRIdNGE
Copy link to clipboard
Copied
Yes that works! Thank you.