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

grep - style for substring

New Here ,
Nov 07, 2023 Nov 07, 2023
Hi,
I have text with the string ".-|"
I want to find the entire string, but use the style only for the first character "."
Adobe says - use cmd+f, type grep (.)(-|) and enter $1 in the >change to< field
but I want to use this grep in paragraph style - how to do it?
TOPICS
How to
155
Translate
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
LEGEND ,
Nov 07, 2023 Nov 07, 2023

Can you show a screenshot of a real text example? 

 

Translate
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 ,
Nov 07, 2023 Nov 07, 2023
LATEST

In a paragraph style, you can only apply character styles with a GREP style. So, you'd have to find all full-stops followed by hyphen and pipe, but not include the hyphen and pipe, correct? 

 

The two easiest ways are:

1) Don't use a GREP Style, use a Nested Style instead. You can apply any character style Up To the first hyphen. This only works if you know that any fullstop followed by a hyphen should have the character style applied. If there are exceptions, this won't work. In which case, you can use...

 

2) Use a GREP Style with a positive lookahead. Your first group should be 

(\.)

 The backslash means "only match a fullstop character." If you don't escape your fullstop, it means "any one character" in GREP. Your second group should be 

(?=-|)

 This is a "positive lookahead" which means that it's going to match anything after the ?= but it's not included in what is found.  So it will look for 

.-|

but it is only going to match the period character, not the hyphen or pipe.  

Translate
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