Skip navigation
tkrisztian92
Currently Being Moderated

find/replace help

Dec 13, 2012 1:26 PM

I have 2 problems to solve:

 

1: in a discussion, i have time in format (e.g. 11:04pm). i want to delete these. (anything)pm/am -> to nothing. how sould i search for these ?

 

2: in this same discussion, i have also two names. i want to replace these with a special character (e.g. a square or triangle) perhaps whit a color.

 
Replies 1 2 Previous Next
  • Currently Being Moderated
    Dec 13, 2012 2:26 PM   in reply to tkrisztian92

    If all the times are inthe format in yru example, this should find them: \b\d*:\d\d[ap]m\b  You can replace with nothing. You'll probably want to find multiple spaces after that since this doesn't address the spaces surrounding the time. You could include the leading space if the time is never the start of the line, or the trailing sapce if it's always the start.

     

    For the names the easiest might be to replace the name with formatted contents of the clipboard after copying your special symbol.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 14, 2012 12:09 PM   in reply to tkrisztian92

    Best to keep it all right here inthe forum if you don't mind. That way other users who may be watching the tread or who find it in a search for similar problems can benefit.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 14, 2012 2:27 PM   in reply to tkrisztian92

    No, the expression I wrote before will not find a time with a space between the numbers and the am/pm but adding the space into the expression will, like this:

    \b\d*:\d\d [ap]m\b

     

    \b is a word boundary, so \b\d*:\d\d  looks for zero or more digits (which really isn't what I intended, but it isn't fatal) followed by a colon and two more digits as the beginning of a "word." [ap]m\b lokks for a or p followed by m at the end of a word. An improved expression would be:

    \b\d\d?:\d\d [ap]m\b

     

    the \d? tells ID to that the digit can appear 0 or one time, so you can have either one or two digits before the colon, but not more or none, and exactly two after.

     

    Are you saying now that you want to delete the entire line with the date and time? That can be done as well, but we need to know where the paragraph breaks are, and if there are differnt paragraph styles applied to the lines to know the best approach.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 14, 2012 2:31 PM   in reply to Peter Spier

    Forgot to ask you to show us another screen capture with non-printing characters showing.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 15, 2012 9:41 AM   in reply to tkrisztian92

    You're on the wrong tab. These ar GREP quries, but you've entered them into the Text search field.

     

    The good news is that the date and time lines appear to be separate paragraphs which wil make them relatively easy to remove if that is your intent. Do they have a unique paragraph style?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 15, 2012 9:49 AM   in reply to Peter Spier

    Even without a unique style, I think the following GREP should find and remove those entire paragraphs that end in a time:

    .+\b\d\d?:\d\d [ap]m\r

     

    Leave the change field blank.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 16, 2012 7:45 AM   in reply to tkrisztian92

    OK, try:

    ^(.+)(\b\d\d?:\d\d [ap]m)$

     

    If the paragraph style is already right-aligned, replace with $2 or if not you can replace with ~y$2 which will add a right indent tab before the time.

     

    ^ is the marker for the start of the paragraph, $ for the end (in the find field), so you are looking for all characters from the start of the paragraph and the paragraph must end with the time. The parentheses divide the query into sub-expressions so you can use just a portion of the found text. Changing to $2 tell ID to replace the paragraph with the the text inthe second sub-expression, which is the time.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 16, 2012 1:06 PM   in reply to tkrisztian92

    Sorry, missed the part about the same line the first time. Now that you have things as they are, search for (\r)(~y) and replace with $2

     

    You might like Peter Kahrel's e-book about GREP in InDesign that's available from O'Reilly.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2012 12:45 PM   in reply to tkrisztian92

    1. Set up some character styles with the character color set to the swatch you want to use (create the swatch, if necessary). It looks like you want to apply differnt colors to different names, so you can't do it as a nested style in the paragraph style, but you can do plain text searches for the names using find/change and apply the color style inthe change formatting, or if you don't have lots of names you can do it automatically as GREP styles in the paragraph style definition (just enter the Names one at a time) and anywhere one of the names appears in a paragraph carrying that style it will change color. If you have a lot of GREP styles though, it can affect performance.

     

    2. I think for the character replacement you'll want to copy the gif to the clipboard, then enter the appropriate character in the search field and replace with Clipboard COntenets, Formatted whcih you can choose from the Other selections in the dropdown you get it you click the @ symbol next to the field. Wheter you do this as a plain text search, or as GREP would depend on whether is is always the same character you want to replace, or if there are multiple characters do you want different repalcements for each.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2012 2:20 PM   in reply to tkrisztian92

    Before you can choose a custom color for the text you need to create a new swatch for it.

     

    The repalcement works here, so I suspect it's what you have on the clipboard. Place the gif on the pasteboard and size it the way you want to use it, then select it and copy to the clipboard.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2012 3:23 PM   in reply to tkrisztian92

    You're welcome.

     

    For a native English speaker I would recommend some training materials, for example Sandee Cohen's Visual Quickstart book for InDesign, or the video training on Lynda.com, but I'm not familiar with waht is available in other languages. If you tell us what your native language is, though, we have regular responders from around the world who might have a good recommendation for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 18, 2012 11:58 AM   in reply to tkrisztian92

    tkrisztian92 wrote:

    one thing more:
    when i place this smiley gif into the document, it scales it up. why that ?

    Do you mean when you place it before copying, or after the Find/Change? You probably need to scale it to the size you want to see after placing and before copying.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 18, 2012 12:23 PM   in reply to tkrisztian92

    Do you have High Qualtity Disopaly enabled under View > Display Performance?

     

    Might also just be the way ID dispalys the preview. Im Photoshop you are viewinghte actual pixels, in ID it's a screen preview. Hpow does it look in the exported PDF or in Print?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 18, 2012 3:07 PM   in reply to tkrisztian92

    At 100% on screen in ID and Photoshop it looks essentially identical here, though it looks and prints pretty badly in the PDF. Of course it looks aout the same printed from Photoshop, but it's only 14 x 14 pixels at 72 ppi, so you really can't expect much in print. That image was meant for use on the web. If you want something crisp in print, draw a smiley in Illustrator and use that instead.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 19, 2012 3:57 AM   in reply to tkrisztian92

    As I said, I printed your smiley from photoshop and from a PDF made in ID using the High Quality Print preset, and they essentially looked the same on paper -- bad.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 30, 2012 11:55 AM   in reply to tkrisztian92

    That usually indicates something about the text in the first line that's overset that makes it impossible for ID to fit it in the frame. A long string with non-breaking spaces and hyphenation not allowed can do that, as can applying No Break to a lot of text. I've seen text that was in a size too large to fit a single word, and indents that combined were wider than the column. Keep options will be the cause on occasion, too. You'll need to examine that text in Story Editor and do a bit of detective work.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2012 6:28 AM   in reply to tkrisztian92

    In these lines are all of thetimes in italics? If they are you can look for \d\d?:\d\d [ap]m$ (which is a time at the end of a paragraph). Set the Find formatting options to Italic, and in the change formatting either set the alignement to Right Aligned or apply a pragraph style that's right-aligned.

     

    In fact, now that your other times are all on a line by themselves, it might be cleaner to change from the right-indent tab to a right-aligned style for them, too.

     

    You can find the right aligned tabs by searching for ^~y  Replace with nothing and set the right aligned as aparagraph style or local override inthe change format options as above.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2012 7:49 AM   in reply to tkrisztian92

    OK, sorry. I'd forgotten that was the goal. None of what I said in the last post was useful for moving the times/dates onto the previous line. Can you undo or were you working on a copy of the file (a really good idea in case of these mistakes)?

     

    Please post another screen shot of what the text looks like now (after any recovery from my previous advice if possibile).

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2012 10:00 AM   in reply to tkrisztian92

    Starting from what it looks like now, try this:

     

    Find: (\r)(.+\b\d\d?:\d\d [ap]m)$

     

    Change: ~y$2

     

     

    then

     

    Find: ~y(?=~y) and leave the change field blank. That should remove the duplicate right indent tabs.

     

    I have not tested this, so please try it on a copy.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2012 1:20 PM   in reply to tkrisztian92

    Don't know if you still desire a vector smiley face or not. The following link is to an Illustrator file. You (or anyone) can feel free to use it, modify it, commercial use, etc., etc., forever. Sooner or later it will be cleaned out of the temp folder on the web site.

     

    http://www.wenzloffandsons.com/temp/smiley_02.ai

     

    Do note it is larger than you need for this purpose.

     

    Take care, Mike

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 1, 2013 10:32 AM   in reply to tkrisztian92

    you can use a positive look behind to find the right indent tab without selecting it and then only select the text that follows it.

     

    (?<=~y).+$ will find any text up to the end of that paragraph following a right indent tab.

     

    (?<=~y).+\b\d\d?:\d\d [ap]m$ will match only if the last part of the line is a time.

     
    |
    Mark as:
1 2 Previous Next

More Like This

  • Retrieving data ...

Bookmarked By (0)