Skip navigation
discoamphetamine
Currently Being Moderated

GREP style word containing vowels

Dec 3, 2013 3:37 AM

Tags: #grep_styles #grep_issue

Hi there folks

 

Been playing around with GREP styles for a while but couldn't find any solutions for this problem.

 

I making a book with products in it so all product got a different name. What I want to do is having one of the vowels in the product name to be colored red.
I'm at the point where I can style all the vowels of a word so for instance I got "Voltage" where I have the "o" "a" "e" colored red.

 

Thing is I only want one character of these vowels to be colored. Either "o" "a" or "e" but not all of them.

 

How do I do this?

 
Replies
  • Currently Being Moderated
    Dec 3, 2013 5:26 AM   in reply to discoamphetamine

    Maybe you could show what you got so far?

     

    "Only one of the vowels colored" is not specific enough for a GREP style -- you need to provide an *exact* specification and say which one.

     

    If you know in advance which character you want to color in what word, you can use lookbehinds and lookaheads:

     

    (?<=\bVolt)a(?=ge\b)

     

    Or, more generalized, this will color the very last [a, e, o] in any word:

     

    [aeo](?=[^aeo]*\b)

     

    but it uses a lookahead of indeterminate length, so you cannot switch it around and use a lookbehind to find the first [a,e,o], because lookbehinds do not support this.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 5:56 AM   in reply to discoamphetamine

    This is where GREP Styles are sometimes not needed

     

    If it's just the first letter that is required to be highlighted

     

    This works fine with Nested Styles

     

    http://snag.gy/HBJmi.jpg

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 5:57 AM   in reply to Eugene Tyson

    This catches the First Letter that's a vowel

     

    http://snag.gy/akEvj.jpg

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 5:59 AM   in reply to Eugene Tyson

    Note that in GREP the "pipe symbol" means OR that's the |

     

    In the above example I used it as a separator.

     

    The | "pipe symbol" does nothing in Nested Styles.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 6:24 AM   in reply to Eugene Tyson

    Eugene Tyson wrote:

     

    The | "pipe symbol" does nothing in Nested Styles.

    Actually, it does. It matches a | (Pipe) in the text, but since you haven't got one before the first appearance of a vowel it has no effect. I'd leave it out as irrelevant in this case.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 6:45 AM   in reply to Peter Spier

    Peter Spier wrote:

     

    Eugene Tyson wrote:

     

    The | "pipe symbol" does nothing in Nested Styles.

    Actually, it does. It matches a | (Pipe) in the text, but since you haven't got one before the first appearance of a vowel it has no effect. I'd leave it out as irrelevant in this case.

     

    I meant to conclude with that statement but I got distracted by something shiny (thing called work )

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 3, 2013 7:08 AM   in reply to discoamphetamine

    discoamphetamine wrote:

     

    Looks great but I want the vowels to be randomly colored. Seems to me right now that I need to do this manually cause there's no rule for that with GREP or Nested styles.

    GREP can't do it, but I bet a script can.

     

    I think Jongware already has some randomizing routines...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points