GREP Question:  Style em spaces that precede only certain triggers within a paragraph

Hello,
Up front:
I do not know GREP well enough to begin to tackle this.  And as usual, I'm in a pinch!
Also, if you're the visual type, just look at the second to the last paragraph at the bottom, and that may be enough to help you devise the GREP style.  Otherwise, bear with me, I have to think this through...
I have a list that spans pages of events.  The events are formatted as follows:
☐Box City EventNameSpecific Month EndPara (this is a single paragraph in a story of a hundred such paragraphs)
On paper, each event will need to be preceded with a filled specific-colored box (☐).  I would like this box to be made from a strikethrough applied to an em space using grep, since that is very easy to create using a character style and only requres one setting (the thickness of the strikethrough).
There is a legend at the bottom of the page, detailing about 14 types of events.  Some of the different types of events will require the same colored box.  But in all I have 7 different colors of boxes in the legend.
I'm looking to create...
7 character styles, one for each color (consider this done already)
1 paragraph style (essentially done, but missing the GREP)
7 GREP styles (or more as necessary) specifically to apply only to the em space that precede specific sets of text strings
If I need, or if it is simpler to create 14 GREP styles within the paragraph style, that's fine.  But I understand we may be able to do something like this... (Target phrase 1 | Target phrase 2 | Target phrase 3) in between parenthesis to identify multiple possible triggers within the same rule. 
I'm fine whether it's 7 or 14 rules in there, I just want to be able to update them over the course of time as necessary - but it won't be for another season at least if I do.
I don't know GREP well enough to piece together what I need.  Vaguely familiar with look aheads and look behinds.  I do understand it may be easier if the em space is in between other characters, so in my example below I've inserted hairspaces.  But ultimately I want the em space to be flush or nearly flush to the left of the frame.
For my example below:
I only want to apply character styles to em dashes based on the strings in bold.
The strings of text that will trigger the GREP will vary in number of words and may or may not contain a dash.
I want to ignore Citynames regardless of number of words... Chicago vs. San Francisco vs. Vancouver, BC for example.
I want to ignore MonthofYear which appears after the second tab.
The tabs will have set stops as a regular part of the paragraph style.  I'm including them in my example below in case it helps to visualize possible anchors to use in GREP.
I want the style to be easy enough to modify, for example if I want to simply add an (EEEE New Eventname) to the list of possible options within a rule that triggers a specific character style.  See below should make it clearer.
So here's what I'm thinking...
Within the Paragraph Style, the first two examples of GREP Styles should be able to respond to the following criteria:
Rule 1:  If the paragraph contains any of the following, then apply Char Style 1 to the em dashes in those paragraphs. Use a unique GREP expression for each phrase below where each uses Char Style 1 or use a single GREP expression to capture all three possible triggers:
ABC BB Invitational
ABC Xxxxxxxxxxxxxx
ABC MM-Xxxxxxxxxxxxxxx
Rule 2: If the paragraph contains any of the following, then apply Char Style 2 … and so on
Global ABC Xxxxxxxxxxxxxxx
Global WXYZ Xxxxxxxxxxxxxxx
I cannot count on “ABC” or “Global” being the trigger for the style, if you know what I mean.  I need the entire phrase (ABC BB Invitational) to be the trigger… if it exist in its entirety, then apply the style to the preceding em dash in that paragraph.  This way if there are any mispellings or if we launch a new event type which ends up flowing in to my document I will know it.
hairspace  emspace  tabspace CitynameOneWord ABC BB Invitational tabspace MonthofYear
hairspace  emspace  tabspace  Cityname TwoWrds ABC BB Invitational tabspace MonthofYear
hairspace  emspace  tabspace  Cityname MultiWrds ABC BB Invitational tabspace MonthofYear
hairspace  emspace  tabspace  Cityname TwoWrds ABC MM-Xxxxxxxxxxxxxx tabspace MonthofYear
hairspace  emspace  tabspace  Cityname MultiWrds ABC Xxxxxxxxxxxxxx tabspace MonthofYear
hairspace  emspace  tabspace  Cityname TwoWrds Global ABC Xxxxxxxxxxxxxxx tabspace MonthofYear
hairspace  emspace  tabspace  CitynameOneWord Global WXYZ Xxxxxxxxxxxxxxx tabspace MonthofYear
hairspace  emspace  tabspace  CitynameOneWord Global Special Xxxxxxxxxxxxxxx tabspace MonthofYear
hairspace emspace tabspace  CitynameOneWord Globl Special WRONG SPELLING  tabspace MonthofYear
I hope this makes sense and isn't too unnecessarily redundant.  Time for bed.  Fingers crossed someone will post at least one GREP string, so I have some magic code for tomorrow morning!  Ideally, it would be great if you would include a brief explanation of waht the string is doing, but minimally, please do use one of my text stings above, so I know what to mess with and what not to.  ;-)
<says prayer>
Thanks!
Rick

Well, for a moment I thought I had an idea of how to do this with GREP styles, but I realized it wouldn't work, and I'm not sure it's possible unless you are able to make a separate style for every possible string between the em space and the trigger text. You want to use the lookahead because you want to find that text, but you don't want to select it or apply the style to it, but a lookahead can't handle the kind of variability on string length that you need to work based on just the bolded text at the end.
It would actually be easier to use paragraph styles based on the bolded text that include a nested character style, I think. That could be handled by find change, but I think the best thing is probably to move this over to scripting.
Rather than just move the discussion, though, I'm going to ask you to cross post so there are two threads on the chance that someone else who doens't visit scripting might have another idea for you here.
Here's a link to scripting: InDesign Scripting

Similar Messages

  • Print button that prints only certain pages

    I am using Acrobat Pro, and have a large document, the first four page section of which can be a stand alone document.
    I have set up one print button which uses Execute a menu item > File > Print, for users who want to print the whole document.
    I would like to create another button that prints only the first four pages - is this possible?
    Thanks in advance

    You need the Acrobat Pro forum

  • Questions that pertain ONLY to PSE 9 and/or PSE 9 Organize?

    Is there a way to populate questions in this forum that pertain ONLY to PSE 9 and/or PSE 9 Organize?

    Barbara and Ken, thanks much for the update and the suggestions. I get the gist of the situation and will proceed with that in mind. I'll be back if/when I have specific questions. I'm about 8,000 images into organizing about 20,000 currently and am still in the learning stage. I'm about to try Adobe's synchronization offer (I have a main, an office, and laptop computer) and I'm very anxious about just jumping into the unknown - meaning I've never done this before. Just trying to get a feel for what others might have done wrong previously. Thanks to both of you. jannterr.

  • Since upgrading to Mavericks, 10.9.1, pictures that come attached to emails no longer display.  There is only a blank space that after about 1 minute, has a small box with a question mark.  How can I go back to attached images?

    Since upgrading to Mavericks, 10.9.1, pictures that come attached to emails no longer display.  There is only a blank space that after about 1 minute, has a small box with a question mark.  Double clicking on the box will open the image in a separate window.  It's very slow and tedious for multiple images.  How can I go back to attached and displayed  images?  If I click on "Forward", the images appear instantly in the email to be forwarded.

    Scott,
    My problem seemed to fix itself.  Or, by shutting down the computer one night, instead of putting it to sleep, may have reset something.  Since updating to Mavericks, I always (or usually) let the computer sleep overnight or anytime I'm walking away from it.  A few days ago, I was updating notes for my kids about how to find all my stuff and how to turn on my computer, so I wanted to rewrite the start-up procedures for the iMac, just in case they ever need to.  Well, I shut it down one night so the following morning, I could write down each step.  Lo and behold, the images, etc. are all there again!  Solved, but I'm not sure why.
    Tom

  • I have a ipod touch and i got it for christmas with an iTunes card .the problem is that i downloaded videos and now it said that there is not enough space and i only downloaded 8 and now 5 don't download how do i erase them.can  get my money back

    i have a ipod touch and i got it for christmas with an iTunes card .the problem is that i downloaded videos and now it said that there is not enough space and i only downloaded 8 and now 5 don't download how do i erase them.can  get my money back

    Whatever you read about iTunes is wrong unless you're actually referring to feature movies, not videos. Videos, apps, music and iBooks you can re-download:
    http://support.apple.com/kb/ht2519
    Download to your computer and then sync to your iPod touch whatever will fit.
    And no, I can't say with certainty that they won't give you a refund, but it's unlikely. The most probable outcome, if you do indeed mean movies, not TV shows or other videos, is that they would set up an additional download. For other content they'll probably just direct you to the same instructions on re-downloading I just posted.

  • Add space between set of Symbols - Grep Question

    hi everyone,
    I have another Grep question someone hopefully can help with. I need to find the following symbols in my long document < > + =      
    All these symbols need space either side of the character. I would like to setup a grep expression and have it find the symbols and add spaces either side. So far I can find each symbol but can't figure out how to add spaces before and after with the replace feature?
    find:
    =|<|>|+
    replace:
    can anyone help..
    lister

    Use this line in Find option: \+|\=|<|>
    Use this line in Replace option: <space>$0<space>
    Siva

  • My iphone 5 internal storage is full, I have just 1000 picutes of size 2mb each an average that costs only 2gb, what happened to remaining 6 gb space?

    my iphone 5 internal storage is full, I have just 1000 picutes of size 2mb each an average that costs only 2gb, what happened to remaining 6 gb space?

    The size of the pictures themselves is only part of the story...Photos also prepares indexes of the pictures, thumbnails and further file information that take up, sometimes, as much or more space than the photos.
    Other things like email, messages, tunes, cache information, browser history information, and so on take space.

  • My computer is telling me that I only have 270mb free on my 8gb usb, however it is only showing 1.4gb used.  How do I free up the rest of the space?  reformatting?  help?

    My Mac is telling me that I only have 270mb free on my 8gb usb.  The only items showing on it come to 1.4 gb.  Why is this, and can I reformat it and how??

    http://www.ehow.com/how_4927355_format-usb-flash-drive-mac.html
    guide

  • Grep Question

    Can I specify a paragraph style in a grep query?
    I want to have a grep style that is only triggered if the paragraph before has a certain style in use. I figure if I can specify the style in a look behind this should be possible no?

    yeah.. imagine you have a space after attribute on paragraph style 1, and space before on paragraph style 3. I am looking for a way to make it so that I can avoid a double sized space when style 1 is followed by 3.

  • Why is my iPod running slow, uses nearly 600MB of space that I'm not using, and have short battery life?

    I have owned an iPod touch for about a month now and I having some problems with it. On occasion, my iPod is running very slowly, even when I keep my multitasking bar empty, the native apps such as the App Store, Music, Videos, etc. lag a lot whenever i try to access content. This was not the case for me when I was running iOS 4, in which my iPod ran extremely fast and had great battery life. I most of the time keep my wireless turned off (to be specific, i turn on airplane mode approx 3/4 of the time) along with my brightness turned all the way down. Any suggestions?
    I also have another concern with my storage space. I have an 8GB 4th Generation, and whenever I plug it into iTunes, I notice nearly 700MB of space that I am not using on my iPod, I have gone through all of the data and calculated that the 700MB of space that iTunes classifies as "other", i am not using this storage space. Is there anything that I can do about this or do I have to erase everything and restore to get rid of this?
    Thank you for taking the time to read my question, and if you can, please answer.
    Thanks.

    - iOS 5 does slow the iPOd.  Periodically powering off and then back on helps since it free up memory that apps do ot release. The iPod only has 256 MB of memeor and low memory slows the iPod.
    - iOS 5 also increases battery drain. I leave mine in airplane mode when not using wifi or BT. Also see:
    iPod: How to extend battery life
    - An other of about 1/2 GB is normal and expected.  to get it down you need to restore your iPod.  Sometimes restoring from backup works but sometimes a restore to factory defaults/new iPod is required.

  • My emails are received with inexplicable question marks for spaces

    My emails are received with inexplicable question marks for spaces. This seems to only happen on some computers. Help!
    Mac Mini   Mac OS X (10.4.4)  

    I was looking over the help that you gave about the question marks in email responces, and wondered if you knew anything about fractions in the mail info.
    When I get mail on my power book, the information as to whom it from and date etc. is all fractions. This is also happening in my address book. I've tried changing fonts to see it that was the problem and it hasn't seemed to work. Any other ideas?

  • How do I remove songs that are only in iCloud?

    Hello. Sorry if this is in the wrong category.
    I realize there are going to be tons of questions since iOS 7 just came out, but I have a question about iCloud.
    So now that I have the new iOS, the music library on my iPhone displays my iCloud music as well as what I had synched to the phone. However, there are some songs showing up that I deleted from my iTunes library on my computer months ago. They are not on my computer, so I cannot delete them from iCloud as I delete them from my computer. There are a few songs that I will keep on the Cloud, but I don't want them all.
    How would I remove these songs that can only be found in my Cloud? I don't some of them anywhere, at all. I'm not paying for iTunes match.
    Thanks in advance!

    Hey, Gail,
    Sync didn't work last night even with the new version of iTunes.  I think I solved it though.
    Went to Settings > General > Usage > Music: Deleted all data that way
    Then turned on the "Show all music" option in the Music settings.  Went to music and downloaded from the iTunes cloud the music I wanted on my phone.  With that done, I shut off the "Show all music" option again.  This left just the songs that I had downloaded.
    I'm sure I could probably accomplish this similarly by dragging and dropping to my phone from iTunes.  I'll have to give this a shot.  Worst case scenario, it doesn't work.  But I've found a way that does.
    So far, those songs I didn't want haven't shown back up.  Whether this is a permanent fix, I haven't had time to see yet.  But it's worked at this juncture.
    Thanks for checking in,
    Ryan

  • How can I get the amount of free space that is on my drive to show at the bottom of the drive in Lion.

    How can I get the amount of free space that is on my drive to show at the bottom of the drive in Lion.
    This is a must feature for me and I may have to go back to Snow Leopard.
    Please help!

    Right click on your desktop and choose "viewer options". Adjust the spacing and the size of your icons and you should be able to see the size of your drive(s) and the free space available on each drive with the exception of your bootcamp drive which will only show the overall size of the drive you have it on.  This may be different if you only have one system drive (like on a Mac Book Pro) with a partition containing bootcamp on it. this may only show you the overall capacity, I can't say for sure though as I only use a Mac Pro with 4 seperate Hard Drives which are showing both overall capacity and free space available. Hope this helps
    Denisimo

  • How do I get rid of the "other" space that's taking up my disk space?

    So my mac has been constantly giving me notifications about how my hardrive space is almost full. So I went into my storage space to find out what was taking up so much space on my laptop to find that this "other" seems to be taking up the most space. So I was just wondering how I can decrease this or how I can get rid of it?

    For information about the Other category in the Storage display, see this support article. If the Storage display seems to be inaccurate, try rebuilding the Spotlight index.
    Empty the Trash if you haven't already done so. If you use iPhoto, empty its internal Trash first:
              iPhoto ▹ Empty Trash
    Do the same in other applications, such as Aperture, that have an internal Trash feature. Then restart the computer. That will temporarily free up some space.
    According to Apple documentation, you need at least 9 GB of available space on the startup volume (as shown in the Finder Info window) for normal operation—not the mythical 10%, 15%, or any other percentage. You also need enough space left over to allow for growth of the data. There is little or no performance advantage to having more available space than the minimum Apple recommends. Available storage space that you'll never use is wasted space.
    When Time Machine backs up a portable Mac, some of the free space will be used to make local snapshots, which are backup copies of recently deleted files. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown as  Backups. The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself. If you followed bad advice to disable local snapshots by running a shell command, you may have ended up with a lot of data in the Other category. Ask for instructions in that case.
    See this support article for some simple ways to free up storage space.
    You can more effectively use a tool such as OmniDiskSweeper (ODS) or GrandPerspective (GP) to explore the volume and find out what's taking up the space. You can also delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one. Note that ODS only works with OS X 10.8 or later. If you're running an older OS version, use GP.
    Deleting files inside an iPhoto or Aperture library will corrupt the library. Any changes to a photo library must be made from within the application that created it. The same goes for Mail files.
    Proceed further only if the problem isn't solved by the above steps.
    ODS or GP can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    If you have more than one user account, make sure you're logged in as an administrator. The administrator account is the one that was created automatically when you first set up the computer.
    Install the app you downloaded in the Applications folder as usual. Quit it if it's running.
    Triple-click anywhere in the corresponding line of text below on this page to select it, then copy the selected text to the Clipboard by pressing the key combination command-C:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    sudo /Applications/GrandPerspective.app/Contents/MacOS/GrandPerspective
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing command-V. You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. Ignore any other messages that appear in the Terminal window.
    The application window will open, eventually showing all files in all folders, sorted by size. It may take a few minutes for the app to finish scanning.
    I don't recommend that you make a habit of doing this. Don't delete anything as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means. When in doubt, leave it alone or ask for guidance.
    When you're done with the app, quit it and also quit Terminal.

  • How to install a big program that is only available for PC on a Mac.

    Hi everyone,
    I really need help about that, I've just start a new job that requiered 20-20 Design, witch is only support by PC. But I don't want change my Mac for PC My iMac has Bootcamp already so I need to know, if I'm installing Windows Vista or 7 (witch is requiered by my program/software...I don't know how I'm suppose to call it in english), will I be able to make it work? And if it can help, my 20-20 design is working with an USB key not an installation CD. I've read a lot of topics but no one answer my question
    Thanks for your help....you can save my life, my job and my Mac :P

    How to install a big program that is only available for PC on a Mac.
    Run the Boot Camp Setup Assistant. Install Windows. Install your "big program"

Maybe you are looking for

  • Can I use the install disk on two computers?

    I haven't actually installed it on my computer yet, I just allowed whatever was going to install itself to come up. If I have another computer, can I use the install disk to put OSX on there or not? If so, can I still use it in case I need a backup l

  • Appear to lose connection with the Shared Variable Engine

    Have been through the boards, but with no success regarding the specifics of my problem. I am running a real-time application on a PXI-8108.  The host software is taking care of user interface, etc.  Information exchange is handled using Unbound Netw

  • Discussion forum in other languages?

    Hi, Is there a discussion forum in dutch please?

  • Launch Application when .txt file is clicked. (2nd .txt invocation prob.)

    Hi, I have mapped the document type (.txt) extension with my application's .exe file, so that it will open .txt file in my editor. Everything works fine when I m double clicking any .txt file in explorer. It is launching my application and opening th

  • Missing Installer when I download Flash 10.0.32.18.

    It appears that the flashplayer-installer is missing and all I get when I download the latest Flash is the libflashplayer.so file.  If anyone else is having the same problem, I was able to install this using the installer from an older version 10x. W