Skip navigation
Currently Being Moderated

Need a Grep Expression for changing a space between braces.

Feb 20, 2013 11:33 PM

Tags: #text #indesign #styles #grep #cs6

Hey All --

 

I know this has got to be ridiculously simple for anyone that knows Grep.

 

I have a string of text in braces like this:

{namevalue="Firstname Lastname”}

 

And I would like to add any special character or word between the first and last names so I can make some additional changes to the structure via find/replace.

So I would like to change it to this for example:

{namevalue="Firstname$$$Lastname”}   or this: {namevalue="FirstnameKAPOWLastname”} or this: {namevalue="Firstname12434Lastname”}

 

You get the picture. Any assistance will be greatly appreciated.

 

 

 

 


 
Replies
  • Currently Being Moderated
    Feb 21, 2013 2:23 AM   in reply to Image+Type

    Like this:

     

    Find what: (\{namevalue=".+?)\s(?=.+?"\})

    Replace with: $1@@@

     

    (                           // start capture

    \{namevalue="    // literal {namevalue="

    .+?                       // followed by one or more of any character . . .

    )                           // end capture

    \s                         // . . . up to the first space . . .

    (?=.+?"\})             // . . . but only if followed by some characters ending in }

     

    It could be simpler --

     

    Find what: (\{namevalue=".+?)\s

    Replace with: $1@@@

     

    Need coffee.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 21, 2013 3:19 AM   in reply to Image+Type

    Just to clarify, is {namevalue="Firstname Lastname”} what actually appears in your text, or is that a generic example and the actual text contains actual names?

     

    What the other Peter first posted is fine if the string is actual, but not for real names. The good news is he edited his post (which you wouldn't know unless you come back to the web page) and his second version should work in either case.

     

    Note to Peter: there's no email update when a post is edited so it's probably better to add a correction post instead. Are we even for the day?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 21, 2013 3:42 AM   in reply to Peter Spier

    > there's no email update when a post is edited so it's probably better to add a correction post instead.

     

    Ah, thanks, I didn't know that.

     

    > Are we even for the day?

     

    Yep. But it's still early. . .

     
    |
    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