GREP Expression Needed

I'm reposting this here, hoping some genius scripters will know more than the designers ---
I've scoured the websites and have been trying to figure out the correct GREP expression for what I'm trying to achieve, but to no avail, so alas I am posting this in hopes of ending my misery.
I want to add an italic character style to the names of Naval ships (USS xxx xxx) in my book.  I want to italicize the name, but not the 'USS'. Any ideas?
Thanks a million.
~Laurie

Here you go (needed a break). Write the names in a text file, one name per line, and save it in the scripts folder using the name uss_names.txt. The first line in that file must be the name of the character style you want to use. If that style doesn't exist, the script creates it.
Peter
if (app.documents.length == 0) exit ();
// Read the text file
ship_names = get_list ();
// Create character style if necessary
if (app.documents[0].characterStyles.item (ship_names[0]) == null)
    app.documents[0].characterStyles.add ({name: ship_names[0]});
app.findGrepPreferences = app.changeGrepPreferences = null;
app.changeGrepPreferences.appliedCharacterStyle = app.documents[0].characterStyles.item (ship_names[0]);
for (i = 1; i < ship_names.length; i++)
    app.findGrepPreferences.findWhat = "(?<=USS\\s)" + ship_names[i];
    app.documents[0].changeGrep ()
function get_list ()
    var f = File (app.scriptPreferences.scriptsFolder + "/uss_names.txt");
    if (f.exists)
        f.open ("r");
        var temp = f.read ()
        f.close ();
        return temp.split (/[\n\r]/);
    else
        alert ("Can't find uss_names.txt.");
        exit ();

Similar Messages

  • GREP reference; need end-of-paragraph expression

    GREP reference; need end-of-paragraph expression
    I'm doing a canned GREP search to delete all trailing zeros. So if I have a number like 8.2500, it changes it to 8.25.
    I have the code to find zeros leading up to a space, line break, and paragraph return but I can't find the expression for an end of paragraph. With hidden characters on, it looks like a hash ( # ).
    Does anyone know what this is?
    If anyone knows a more elegant way to do this, please advise. Here's what I have:
    0+$|00+$|000+$|0000+$|.0000+$|0+\s|00+\s|000+\s|0000+\s|.0000+\s|0+\n|00+\n|000+\n|0000+\n |.0000+\n|0+\r|00+\r|000+\r|0000+\r|.0000+\r

    See my answer in the Script forum: http://www.adobeforums.com/webx/.3bbf275d.59b4d546/0
    (You shouldn't post a question twice.)

  • Need grep expression to change index page numbers

    I built an Index using Type&Tables>Index however there was a lot of additional work that had to be done manually after it was built, so I do not want to use the Replace command. Is there a grep expression I could use in Find Change to find the "tab + page number" and replace with "tab + page number adding 2" (i.e., so an item originally indexed to be on page 13 would then be indexed on page 15).

    Take a look at this thread:
    https://forums.adobe.com/thread/1282483
    Jongware's script should fit your needs without any modification, I guess..

  • Need some help with GREP expressions

    I know--KNOW--there's a way to do this, but my GREP expressions keep failing.
    I want to add an em dash before any phrase that's in a paragraph style. So I obviously want the em dash to be in the location "beginning of paragraph." All my GREP searches keep failing. Can someone help?

    Adobe's implementation of "beginning of paragraph" is a tiny bit off from standard GREP (which, in itself, is less a set of hard & fast rules, but more like "guidelines"). Yes -- you can search for beginning of paragraph using plain ^, but you cannot use it with a replace operation.
    The trick is to give InDesign something to look for. Search for
    ^.
    (that's right -- one wildcard right after the start of a paragraph). You don't want to loose the character it finds, so replace with
    ~_$0
    where the first 2 codes is your em dash and the last 2 are "the entire found text". That's your original wildcard-found character!
    Don't forget to put your paragraph style in the Find Formatting box.
    This workaround works around the implementation failure, because you indeed want to add something to existing text. Unfortunately, another fairly standard GREP to look for empty paragraphs -- ^$ -- doesn't work, because then you have no place for a wildcard character ... (and yes, you can use a hard return \r instead of either first or last code, but then it won't work at beginning or end of story). It's one of those things I hope to see corrected with CS5.
    [Edit] Ha! Peter beat me to it but he made a typo. Besides, my story is longer.

  • Help building a grep expression

    hello,
    pls can someone help me build a grep expression for a dictionary:
    abcdef
    hjtoku
    yghmns
    I need an expression that would find in each word where the underline starts, and put, lets say, an asterisk there:
    abc*def
    hjto*ku
    ygh*mns
    thank you in advance!

    Underlines are a character attribute, not a glyph, so there's not a lot of complexity to this. To find underlined characters search for .+ and in the find format section set the basic character attributes to underlined. Understand that this will find underlined characters anywhere, even at the start of the word. If you don't want that it's a lot more complicated and I haven't figured it out myself, yet.
    To add the asterisk change to *$0
    This will add the asterisk, but it will also be underlined, so you need to run a second search for \* (you need to escape the asterisk character in the search field to find a literal *) with the underline attribute and change to nothing, but change the attribute in the change format to no underline, or if you wanted to remove the other underlines as well it could be done in the first step by removing the underline attribute in the change formatting.
    Peter Kahrel has a nifty script for chaining find/change queries to run in one step.

  • GREP expression - find Title Case

    Hello all,
    ID CS4, Vista ultimate.
    I'm trying to make GREP expression to find all words that starts with the
    capital letter (like Italy, America, Europe, John, etc) and to mark them
    with the character style. This is the expression that I figure out:
    \<[A-Z]|[ÈÆ©®Ð]
    The problem is that this finds the words but select only first, capital
    letter and apply character style on this first letter but I want to apply
    character style on whole word (not just on "J" in "John" but to entire
    "John" word).
    Is there anyone who knows how to make GREP expression to find entire words
    that begin with the capital letter?
    Hope this make some sense.
    Thanks.
    -mirza

    A slightly more efficient way could be
    >\u\l+
    -- i.e., one uppercase character followed by one or more lowercase characters. That's with a few reservations, though:
    >\w
    is 'a
    i word
    character -- and that includes upper- as well as lowercase, digits, the hyphen, and perhaps some more characters. I don't know about the (C) and (R)'s (what are they doing there?).
    As a refinement on Peter's expression, though, there is no need to separate [A-Z] and [ÈÆ©®Ð] and then join them again using the OR | and parentheses. You can put everything inside the square brackets, as
    >[A-ZÈÆ©®Ð]
    means just that: A to Z
    i and
    the accented characters and (C), (R). Since you probably don't want to accidentally skip other accented characters (as the You Never Know Principle applies here), I'd suggest
    >[\u©®]

  • Express Needs to be restart every day

    Our Express needs to be reset at least once a day. The green light is on and we can see the SSID but when we use our mac (or any other device) to connect to it, we get connection failed errors. Any idea what can be done to fix this?

    If both devices are producing a wireless network, there is an increased chance of wireless interference between them, especiallyi if they are located in the same room. If you normally only one use one wireless network, it would make sense to turn the other one off.

  • Does my Airport Express need to be hardwired to my modem?

    My Imac and modem are in my basement.  I have an airport express in my garage so i can play music through Airplay.  Does the airport express need to be connected to my modem with an ethernet cable, or can it just connect to my wifi network to enable Airplay?

    See this article, AirPort Utility 6.x: Set up a bridge or AirPort Express: How to join an existing Wi-Fi network in client mode , about configuring the AEX. Be sure to have your Airport enabled on the computer.
    I'm not sure how easy this will be when using a non-Apple router.

  • Does the airport express need to be on the same floor as the apple tv for best streaming?

    does the airport express need to be on the same floor as the apple tv for best streaming?

    Yes. Distance can increase interference causing delays in streaming.

  • HT204371 Does Airport Express need to be configured to allow AirPlay to work between an iPhone 4s and an iPad2?

    Does Airport Express need to be configured to allow AirPlay to work between an iPhone 4s and an iPad2? 
    Also, attempting to use Airplay with iOS7 shuts off sound to the speakers while allowing sound thru the ear buds!  The fix was to restart by depressing the lock switch (opposite the sound out port).

    Does Airport Express need to be configured to allow AirPlay to work between an iPhone 4s and an iPad2?
    You need a minimum of three things for AirPlay:
    An iTunes host. This can be a Mac, PC, or iOS device.
    A wired or wireless network.
    An AirPlay Speaker. This can be an AirPort Express, Apple TV, or a AirPlay-Ready device.
    Is your goal to stream between two iOS devices?

  • Does airport express need to be connected to Internet to use purely for AirPlay ?

    Does airport express need to be connected to Internet to use purely for AirPlay ? Or can I just attach to my stereo and have my Mac connect directly to it in the absence of a wireless network? Tks

    HKCV wrote:
    can I just attach to my stereo and have my Mac connect directly to it in the absence of a wireless network?
    you will have to configure the express to create a wireless network but you do not need a connection to the internet.

  • HT1515 My internet 3rd party access point in in the basement and the speakers I want to stream music to wirelessly are upstairs. Does Airport Express need to be connected to my 3rd party router via ethernet cable or will it stream music wirelessly?

    My internet 3rd party access point in in the basement and the speakers I want to stream music to wirelessly are upstairs. Does Airport Express need to be connected to my 3rd party router via ethernet cable or will it stream music wirelessly?

    Wirelessly
    Just select the option to make your AirPort Express join an existing network in the setup process

  • Airport express needs reboot to be seen by iTunes

    My airport express needs a reboot to be seen by iTunes. Wireless network is Linksys EA4500 with 2.4 Ghz and 5Ghz networks, Linksys RE2000 range extender set up for 5Ghz and airport express set up for 5Ghz. Latest version of iTunes software and apple express firmware. iTunes running on PC.

    Thank you for clarifying that for me.
    It may be possible that the placement of the AirPort Express in relationship to the extended Linksys Wi-Fi network may be the factor that it has to be rebooted when attempting to stream from iTunes.
    Where do you have the Express in relation to both Linksys devices? Same room, different room, different floor? Also were is the iTunes "server" located, again, in relation to all three device when streaming?
    Does the Express still exhibit the same problem for the following two conditions:
    When the Express is placed in the same room as the Linksys EA4500 router with the network still extended?
    When you temporarily disconnect the RE2000 so the network is no longer extended?

  • Airport Express needs resetting to give AppleTV an IP address (via Ethernet)

    So my Apple TV (3rd gen) is connected via ethernet to my Airport Express, but the Airport Express needs resetting all the time for my Apple Tv to get an IP.
    How do I get them to be friends forever without resetting the AE? When the AppleTv gets restarted, it still wont get an IP so I suspect the AE is the bad boy here. 
    Any idea's?

    Has this always happened with the Express or just starting happening recently? If just recently, where there any changes to either the Express' firmware or to the cable modem? What is the make & model of the modem?

  • GREP Expression for Varying Text

    I have an index in which I'd like to Find/Change all the entries with a character style, but stop the GREP expression before the tab, leader, page numb. They vary though. Here are 3 indexed examples:
    A16T-PVUNL-3
    A-100-90-3CT-300
    B-20-22-50-3/4 shank
    Is there any way to constrict this to just the characters and digits, then stopping before the tab? I achieved it in another index whose entries are 7-digits only with this expression: ^(\d+)
    The return constricted it so that search did not find the page numbers after the tabs.
    Thanks.

    http://help.adobe.com/en_US/indesign/cs/using/WSE33E49F9-94CE-4043-AA51-4761408A63F4a.html #WS6F1E524C-8F74-4331-A813-33D08F983E94 is the official help page.
    You'll find a bunch of other resources listed here: http://community.adobe.com/help/search.html?searchterm=Nested+Styles&q=Nested+Styles&lbl=i ndesign_product_adobelr&x=0&y=0&area=0&lr=en_US&hl=en_US

Maybe you are looking for

  • RIO server could not be found on the specified remote system

    When trying to add a cRIO9074 to an empty project, I get the following message:   The RIO server could not be found on the specified remote system. Ensure that NI-RIO software is installed and that the RIO server is running and properly configured. B

  • Links in the webview are not working.

    Hello Everybody, I am showing data in the webview using one custom html page. In this custom html page , I am using css to make the font better and then passing my required data in the respective tabs. In one this tag i.e. description tag, I am passi

  • Lockbox File Format in Europe

    Hi, We are in planning to implement Lockbox functionality for auto cash application in our European company codes. I have few questions: 1)What file formats can SAP read other than BAI2  format.We are using standard SAP program  RFEBLB00 (Transaction

  • Audio Export Issue

    I am making a web clip using Motion. It has a music track and a few lines of dialog. Everytime I export the movie there is a certain part where the audio always drops out. Not the music but the dialog. Why would it do this????? cja

  • Allow a blocked plug in

    I am trying to allow a blocked plug in (Java) on a trusted site. Your directions say that a red Lego-looking icon will appear in the address bar. I do not have this icon. So, how can I allow Java to work on this site? I have installed the latest vers