GREP Expression help

I am new to using GREP and have a find/replace scenario that I'm having trouble with. I have a list of names with middle initials, but no period. I'd like to find the capital middle initial and replace it with the found text, plus a period. I have previously been able to find the middle initial by searching for a space, then any uppercase letter, followed by another space. The problem come in the replace. When I replace with the found text, it adds the space that was found after the capital letter before the period that I am trying to insert. How can express this so that it looks for the space after the capital for the find, but in the replace, puts the space behind the period?

Hi,
Search:  (?<=\s)\u(?=\s)
Replace: $0.
Or, I suppose you play in this way:
Search (\s)(\u)(\s)
Replace: \s$2.\s
Or:
Search \s(\u)\s
Replace: \s$1.\s

Similar Messages

  • 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.

  • 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.

  • Creating a GREP style Help Needed

    I would like to set-up a style using GREP expression(s) that would do the following:
    Everything preceding an em dash (including the em dash and two spaces after the em dash) would be set to bold-italic, AND everything in the paragraph that begins with the word "NOTE:" until the end of the paragraph would be regular-italic.
    Here is a sample of the kind of text I want to format with one style:
    OPERATOR PANEL - The operator panel is located on the right-hand electrical enclosure. NOTE: Not all equipment will have the same operator panel. Refer to schematics for additional information.
    "OPERATOR PANEL - " would be all bold (or bold italic). The body text is regular. the "NOTE: Not all .... " to the end would be regular-italic.
    Any help or direction to a web-site with examples would be appreciated.
    Thanks in advance.
    RPP

    It's easier than you think.
    Peter's suggestion of a regular nesting style might work, except that it's
    i always
    applied to each paragraph you apply it to. That's just what the Grep styles are for:
    i conditional
    stuff.
    The 1st half: Apply Style: Bolded To Text: ^.*? ~=
    (there should be another space after the '=')
    The 2nd half: Apply Style: Italicized To Text: NOTE:.*$
    These are both pretty much basic GREP expressions -- except for the "~=", that's Adobe's --, so just about any google to a GREP repository can explain them. I already knew the basics, but
    this page taught me some new tricks.

  • 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

  • Will an Airport Express help with the signal I am not receiving on my Smart TV?

    Will the Express help with internet issue's I have with my new Smart TV?

    If you already have another Apple AirPort router that is providing your wireless signal, then a new AirPort Express could extend that wireless signal to provide a stronger wireless signal to the TV....assuming that the TV connects using wireless.
    Is this what you are asking?
    Or, would the Express provide other services to "help"?

  • My ipad 2 and ipod touch keeps on dropping wifi connection,  would getting an apple router or maybe airport express help?

    ipad 2 and ipod touch  keeps on dropping wifi, would upgrading to an apple router/airport express help?  all my other pc's work well with my current network.

    Have you checked for a firmware update for your current router?
    What make, model, version router do you have?

  • 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©®]

  • 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..

  • Grep Expressions

    I am looking for grep expression and then one that is an exception to the grep expression. For example.  Acme (one font style and color) and the Boxes (USA) Inc. (another font style and color). And in some places I do not want the word Acme to conform to the grep expression within the document.

    [ Grep something we could translate by "I don't understand anything!" ]

  • 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 ();

  • Seeking help with GREP expression

    I am working with InDesign's GREP feature for the first time. I'm learning the codes but I'm still pretty lost. I'd appreciate some assistance creating an expression.
    The document is a test. I'd like to reflow each question onto it's own page.
    The individual questions look more or less like this:
    LM_CC1234
    ■13»Solorrovit ipietum voluptium fugit, am, si ame.¶
    Olenisquia dis etur rem quia dollenis maximus est?¶
    A»plicius perovit¶
    B»alit ducit fugia¶
    C»vel invel ius¶
    D»offic tem aboriae¶
    I'm open to different possibilities, but right now I'm trying to search for the spot that's either 11 or 12 characters (including line breaks) before the square dingbat (hexadecimal x25A0). The LM_CC1234 identifier sometimes uses a format with one more letter (like SLM_CC1224) hence the 11 or 12 character count.
    Once InDesign has found the spot, I want to insert a carriage return (hexadecimal xD) in that spot throughout the document.
    Thank you for your time!

    Hi,
    Did you consider startParagraph property to use?
    If      LM_CC1234
    or     LM_CC1234
            ■13»Solorrovit ipietum voluptium fugit, am, si ame.¶
    are separate paragraphs -- this option could be set to StartParagraph.NEXT_PAGE,
    so no GREP needed here.
    hope...

  • Help Me Write A GREP Expression?

    I have a list of numbers formatted like:
    (801234123412)
    that should read:
    80-1234-1234-12
    I know it can be done, I just don't know how, and am short on time for learning.

    Try this:
    Find \((\d\d)(\d\d\d\d)(\d\d\d\d)(\d\d)\)
    Replace with $1$2$3$4
    Bob

  • How to create an InDesign Grep Expression to specific words

    I have a long list of congratulations wishes all following a certain pattern. How can I create a grep style with the following sequence:
    Congratulations to [name] upon.....
    The first two words of the paragraph are always: Congratulations to
    Followed by: name
    Followed by: upon.... (then continues with the rest of info)
    There's a general paragraph style to the paragraph, let's call that "body". A  character style, let's call "bold", should be applied to the first word, then skip the word "to", apply the "bold" character style again to the name (however long that may be), and stop at the word "upon". Keep in mind that the word "to" is mentioned again later on, so I wouldn't want to use an expression with all words "to", unless can be specified only the first instance.
    I'm new to GREP, but have figured out so far that the following will give me the applied character style to the first word: ^Congratulations
    Thanks a lot in advance to whoever can help me out here.

    Fabulous guys! Thanks Eugene and Peter. It works great. All I did was add the "nested style > apply to first word" to get the first word bold. I greatly appreciate your assistance.
    One more scenario that I need to get done, if you don't mind. Thanks.
    This one is quite similar, but a bit different:
    Congratulations to [name] son of [names] upon....
    The first two words of the paragraph are always: Congratulations to
    Followed by: name
    Followed by: son of
    Followed by: name
    Followed by: upon.... (then continues with the rest of info)
    Similar as before, but now I need both names [after the word "to" and after the words "son of"] to have the style applied, in addition to the word "Congratulations".
    Thanks for your help.

  • Need GREP expression to Find MD., PhD., FAAC. etc. but not at the end of sentence

    I'm just starting to utiilize GREP a little and was trying to write an expression the would find two or more uppercase or uppercase, lowercase, uppercase combination followed by a period such as MD., Phd., FAAC. etc. I'm attempting to to find those instances and remove the period so that it reads MD, PhD, FAAC etc.
    I came up with (\u\u|\u\l\u+)\. which works OK except that it also finds anything with 2-3 uppercase letters at the end of a sentence as well, which I dont' want.
    I also used $1 in the change to box to capture the phrases which seems to work fine as well.
    I would really just like to not find anything at the end of a sentence.
    Maybe something with lookahead or lookbehind. That's confusing me as well.
    Thanks for any help in advance.

    pixxel schubser:
    Great idea. Here is a sample of the text. I need to eliminate all the periods after the Titles but leave the commas if they are there but I don't want to remove the periods if they happen to appear at the end of sentence. Hope this is clearer. Thank you all for helping out.
    d.
    Author(s):
    Erik Wissner, MD., FACC
    Sebastian Deiss, MD.
    Tilman Maurer, MD.
    Michael Botros, MD.
    Karl-Heinz Kuck, MD., PhD., FACC
    Introduction | Objectives:
    Catheter ablation of atrial fibrillation (AF) using magnetic navigation is feasible with similar long-term success rates, but typically more time-consuming than manual ablation. The 3. generation magnetic navigation system (EPOCH, Stereotaxis Inc., St. Louis, MI) allows for improved catheter response times potentially shortening procedure duration. We compared procedural data using the EPOCH system with previously published data from our laboratory using the 2. generation system for catheter ablation of AF.
    Methods:
    Catheter ablation of atrial fibrillation (AF) using magnetic navigation is feasible with similar long-term success rates, but typically more time-consuming than manual ablation. The 3. generation magnetic navigation system (EPOCH, Stereotaxis Inc., St. Louis, MI) allows for improved catheter response times potentially shortening procedure duration. We compared procedural data using the EPOCH system with previously published data from our laboratory using the 2. generation system for catheter ablation of AF.

Maybe you are looking for

  • How to track the blocked POs in 2LIS_02_SCL extractor

    Hi Gurus,               We have field ROCANCEL in 2LIS_02_SCL extractor which sets to X and R for cancelled and deleted records. On ECC side we either delete the PO (at Item level) or block the PO. For deleted POs the ROCANCEL flag is setting to R an

  • Setting file permissions for 'wheel' group files

    I have a bunch of files I copied from my PC when I made the transition to my Mac. I'm having problems moving or backing up many of the files apparently because the Mac has set the group for these files to 'wheel' and I'm not sure how to change them b

  • IPod nano playing song, stopped midsong, blank screen and can't reboot

    Anyone else encounter this problem? Am I missing a simple step to get this iPod rolling again? Or is it a trip to Wal-Mart for a replacement? It stopped working during the SECOND song it has ever played. Quite disappointed and a major hassle. Any hel

  • Not able to do Net8 Easy config Please Help!!!

    I have installed oracle 8i and oracle designer 6i on my pc with win98. when i try to use net8 easy config, it asks for Host Name, i tried to give the name of the machine and database name, i receive message ora-12224 error message. I would like to kn

  • Multiple SELECTS returned to a REF CURSOR

    Hi there I have a query regarding returning a REF Cursor from multiple selects and any input/hints would be greatly appreciated. Basically, I have a select(from multiple tables) that returns a set of rows(query 1) and another (from multiple tables) t