22 Replies Latest reply on Feb 20, 2014 8:44 PM by pixxxel schubser

    GREP question

    dave c courtemanche Level 2

      I have a situation where nesting styles doesn't work. Working on a catalog and all of my product descriptions end in an item number, then price (#1234; $120). The body of the description is a 45 light weight font, the item number and price a 65 weight font. When working on the US version, I can easily accomplish this formatting with a nested style (Body light up to #). When working on the French or Spanish version, I run into trouble. Those languages use Nº rather than the hashtag symbol. Nesting styles only recognizes one character (though it lets you enter multiple characters in the field - poor design), so any product description with a capital N in them triggers the style change. Is there a way to utilize GREP to say from Nº to hard return, apply X style? Thanks in advance for any feedback.

        • 1. Re: GREP question
          Willi Adelberger Most Valuable Participant

          Use the №-Glyph (NUMERO SIGN), which is a specif single character.

          • 2. Re: GREP question
            dave c courtemanche Level 2

            Will,

            I don't find that character in my font (Helvetica Neue LT Pro)

            • 3. Re: GREP question
              Willi Adelberger Most Valuable Participant

              Because the keyboard layout is different in every language, in every region and on every OS, I can't tell you where it is on your keyboard, but you can find it in the Glyph panel. I think in roman languages it is found easier on the keyboard than in English or German wherethis Glyph is never used. But your font does support it definitively!

              • 4. Re: GREP question
                dave c courtemanche Level 2

                I just looked through the entire Glyph palette in Indesign and didn't see it.

                • 5. Re: GREP question
                  Willi Adelberger Most Valuable Participant

                  Copy it from my first answer into InDesign, if this glyph will appear as glyph, you are lucky, i not, use a similiar font and use a GREP style for that specific character, and you can use it still as stopper for nested styles. But every pro font is supporting this symbol.

                  • 6. Re: GREP question
                    jmlevy Adobe Community Professional

                    Willy, this character is not the proper abreviation of the word “numéro” in French. You want to use a “N” followed by a superscript “o”. So a GREP style is easy to set up.

                    • 7. Re: GREP question
                      Willi Adelberger Most Valuable Participant

                      But Glyph ID 2116 is exactly that, N with superscript O.

                      • 8. Re: GREP question
                        dave c courtemanche Level 2

                        Copied and pasted the character, and it is not in the font.

                         

                        JM,

                        If the GREP style is easy to set up, can you share with me?

                        • 9. Re: GREP question
                          Willi Adelberger Most Valuable Participant

                          1. Select a font, where this symbol is included

                          2. Make a character style which includes this font

                          3. Copy this symbol, or write it into the GREP section of your Para Style and select the cahracter style

                           

                          Every occurance in that Paragraph Style will change the missing glyph into the font where this is included.

                           

                          THe very same method we do here in Europe, when we use a font, which does not support the EURO Symbol (€), because there are often fonts used without the €-Symbol or which have the old Currency Symbol, and when this symbol is contained in a font we use this replacement font.

                          • 10. Re: GREP question
                            dave c courtemanche Level 2

                            Will,

                            That isn't really a good workflow for flowing copy from word docs that do not contain the symbol. I'm sure there is a way to do this with GREP, so it would seem that would be a more productive route. I do appreciate your feedback though.

                            • 11. Re: GREP question
                              John Mensinger Adobe Community Professional & MVP

                              It can be done this way:

                               

                              Untitled-1.jpg

                               

                              My experiments suggest this pulls it off, but there may be unforeseen hitches. As an extra layer of insurance, I'd do a Find/Change to locate each instance of the superscript o and add something after it to make it truly unique...something like a hair space. Then use the string No[hairspace].+ to key the GREP style. Optionally, you might also add the to-end-of-paragraph expression \r

                              • 12. Re: GREP question
                                dave c courtemanche Level 2

                                Awesome. Thank you John.

                                • 13. Re: GREP question
                                  jmlevy Adobe Community Professional

                                  Willy, look, there is a small horizontal bar under the o: №

                                  The correct form in French is no

                                  I was not even aware of the existence of this glyph. According to Wikipedia, it is used in russian.

                                   

                                  Dave, sorry to answer too late, but it was dinner time here in France… And I see you got the answer.

                                  • 14. Re: GREP question
                                    dave c courtemanche Level 2

                                    Not too late at all. I'm in the middle of my work day. Always appreciate the help I receive on this forum. Hope you're enjoying a nice plate of brie and a fine red right now.

                                    • 15. Re: GREP question
                                      jmlevy Adobe Community Professional

                                      Hope you're enjoying a nice plate of brie

                                      No, I prefer camembert…

                                      • 16. Re: GREP question
                                        camilo umana Level 1

                                        Dave, there is a popular script to insert glyphs like:

                                         

                                        if (app.selection[0].constructor.name == "InsertionPoint"){

                                                  with (app.selection[0].insertionPoints[0]){ // insertion point

                                                                                contents = String.fromCharCode(0x2116); // nº

                                                  }

                                        }

                                        //End of script.

                                         

                                         

                                        Also, Laurent Tournier has a very interesting paper on this. (book or blog).

                                         

                                        Also

                                        http://www.kahrel.plus.com/indesign/compose.html

                                         

                                        Checked Helvetica and it includes the glyph 2116!

                                        • 17. Re: GREP question
                                          pixxxel schubser Level 5

                                          John Mensinger wrote:

                                           

                                          It can be done this way …

                                           

                                           

                                          … My experiments suggest this pulls it off, but there may be unforeseen hitches. As an extra layer of insurance, I'd do a Find/Change to locate each instance of the superscript o and add something after it to make it truly unique...something like a hair space. Then use the string No[hairspace].+ to key the GREP style. Optionally, you might also add the to-end-of-paragraph expression \r

                                          That's right. Your Grep No.+ gives false positive results in many cases. Often it's hard (or better: dangerous) to work with .+

                                           

                                          - - - - -

                                          Non, avec cette expression régulière, vous devriez être très prudent! Vous voulez savoir pourquoi? Tourner le Grep sur ce texte. No1234; $120

                                          - - - - -

                                           

                                          It is much more better to do something like this:

                                          No\d+;\s\$\d+$

                                           

                                          or like this:

                                          ..\d+;\s\$\d+$

                                           

                                           

                                           

                                          @dave c courtemanche,

                                          Please try it and give a response.

                                           

                                          Have fun

                                           

                                          • 18. Re: GREP question
                                            dave c courtemanche Level 2

                                            Will do. Thank you.

                                            • 19. Re: GREP question
                                              dave c courtemanche Level 2

                                              FIrst expression did nothing. Second expression didn't capture the N° in the bolding.

                                              • 20. Re: GREP question
                                                jmlevy Adobe Community Professional

                                                I correct what I wrote yesterday: the right form in French is not always an uppercase n, it can be a lowercase depending if the number is inside a sentence or at a beginning of a sentence. So, this regex works:

                                                (?i)No\d+;\s\$\d+

                                                (?i) allows the regex to work both with uppercase or lowercase.

                                                Capture d’écran 2014-02-20 à 23.46.55.png

                                                • 21. Re: GREP question
                                                  jmlevy Adobe Community Professional

                                                  Dave, you also have to be aware that French typographic rules are a little bit complicated: the ; sign must be preceded by a thin space and the currency sign follows the value (123 $). And if the value is a 4 digit number or more, you have to compose like this: 2 345 (it is a thin space, not a regular one) and so on: 34 567, 123 456, 1 234 567 always with thin spaces, so it changes the regex I have indicated in my former post.

                                                  • 22. Re: GREP question
                                                    pixxxel schubser Level 5

                                                    dave c courtemanche wrote:

                                                     

                                                    FIrst expression did nothing. Second expression didn't capture the N° in the bolding.

                                                     

                                                    Hmmh?

                                                     

                                                    For a special Grep like yours I need (and this is very important!!!) the correct sequence all characters!

                                                    If is there any Space between, the Grep do nothing. Do you have parenthesis before and after?

                                                     

                                                    ..\d+;\s\$\d+$

                                                    My second (posted) Grep observed no parenthesis.

                                                    Will only find No1234; $120 at the end of paragraph (but only if there is one space after the ";" and not more spaces anywhere)

                                                     

                                                    Can you give me please the exactly sequence with all spaces you have?

                                                     

                                                    -- begin of sequence --

                                                    opening parenthesis (yes or no?)

                                                    No

                                                    space (yes or no?)

                                                    digits (how much)

                                                    space (yes or no?)

                                                    ;

                                                    space (yes or no?)

                                                    $-sign

                                                    space (yes or no?)

                                                    digits (how much)

                                                    space (yes or no?)

                                                    closing parenthesis (yes or no?)

                                                    space (yes or no?)

                                                    end of paragraph

                                                    -- end of sequence --

                                                     

                                                     

                                                     

                                                     

                                                    If with parenthesis - you can try the following (very general) Grep

                                                    (?<=\()..[\d\s$;]+(?=\)$)

                                                     

                                                    This Grep search for:

                                                    -- begin of sequence --

                                                    opening parenthesis (yes - but not included)

                                                    any character ( 2 times)

                                                     

                                                    digits ( 1 or more times)

                                                    spaces ( 1 or more times)

                                                    $-sign ( 1 or more times)

                                                    ; ( 1 or more times)

                                                     

                                                    closing parenthesis(yes - but not included)

                                                    end of paragraph

                                                    -- end of sequence --

                                                     

                                                    - - - - - - - - - - - - - - - - - -

                                                     

                                                    ..\d+;\s\$\d+$ will find only the exact sequence (if you haven't parenthesis) --> Be aware: is an additional space between - the Grep is failing.

                                                    -- begin of sequence --

                                                    any character ( 2 times)

                                                    digits ( 1 or more times)

                                                    ; ( 1  times)

                                                    space ( 1 times)

                                                    $-sign ( 1 times)

                                                    digits ( 1 or more times)

                                                    end of paragraph

                                                    -- end of sequence --

                                                     

                                                    And if you have parenthesis, than:

                                                    (?<=\()..\d+;\s\$\d+(?=\)$) will find only the exact sequence  --> Be aware: is an additional space between - the Grep is failing.

                                                    -- begin of sequence --

                                                    opening parenthesis (yes - but not included)

                                                    any character ( 2 times)

                                                    digits ( 1 or more times)

                                                    ; ( 1  times)

                                                    space ( 1 times)

                                                    $-sign ( 1 times)

                                                    digits ( 1 or more times)

                                                    closing parenthesis(yes - but not included)

                                                    end of paragraph

                                                    -- end of sequence --

                                                     

                                                     

                                                    Have fun