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

Similar Messages

  • Grep Title Case

    There is a very useful discussion (http://forums.adobe.com/message/4269565#4269565) on getting a paragraph style (e.g. for headings) to produce Title Case by specifying a Grep style (which comes down to using a caps character style and the grep expression \s\S). Is there a way of restricting this to words of four or more letters? That would produce a better Title Case, without 'by', 'a', 'an' etc. having a capital. That discussion does suggest a list of exceptions, which works, but my list is getting rather long. 

    (?<= )\w(?=\w{3,}) as the query string will find any word character preceded by a space and followed by three or more word characters.

  • Using Grep to find/replace

    I'm trying to find out how to use GREP in find/replace to chage the formatting of some text that comes in from a spreadsheet.
    I worked out the GREP query "~b(\d\d)~b", which finds a paragraph return, followed by two digits, followed by another paragraph return
    and then it is replaced by "\t $1~b", which is a tab, the two found digits and a para return.
    What i need to do is to amend the query to find ANY number of digits, (which may be comma delimited: eg 23, 36, 48 ,50), and then replace with a tab + found text.
    I suppose what I'm looking for is a way for the query to find "any text between two paragraph returns, no matter what tthe length", but I don't know how to do this.All the Wildcard options seem to find just one exampler (one digit, one character etc)

    And you came so far
    The operators for repeat are ? (zero or once), * (zero or more) and + (once or more). You can also specify exact numbers: {at least,up to}.
    All of these operators are "greedy" by default -- they will match as much as possible. To match as least as possible (which I'm sure you'll come up against, sooner or later), add another ? after the repeat expression.
    So this will find one digit, then optionally another (which will always be included):
    \d\d?
    and this one digit, then zero or as much as ten million million zillion:
    \d\d*
    which is functionally the same as
    \d+
    And this will find between 3 and 8 digits but will forced to use the shortest possible match:
    \d{3,8}?
    That said: A quick & dirty solution for your actual problem is to find any amount of digits, spaces, and comma's:
    ~b[\d, ]+~b
    (we need the plus here because otherwise it would also match an empty line). The [..] brackets an Inclusive list --- it will match any of the single codes inside.
    A more complicated but 'neater' way is to search very specifically only for number, comma, space, number sequences -- it's neater because that way malformed lines (comma without a space) will be skipped!
    (It also introduces another code -- the parentheses operators. Look them up in a good GREP reference --lost of people are enthousiastic about Peter Kahrel's O'Reilly title, because it's about using GREP in InDesign.)
    ~b\d+(, \d+)*~b

  • GREP: Bolding a title in quotes at the beginning of a paragraph

    Hi,
    I trying to use GREP within a paragraph style to bold the title of a listing at the start of a paragraph. I want to limit it to the first set of quotation marks, and leave any other characters within quotes in that paragraph un-bolded.
    I used the expression below, which i thought would start at the beginning of a paragraph (^), left quotation mark (~{), any character, any number of times (.+), followed by a right quotation mark (~}), followed by a space (\s), zero or one times, shortest match (+?).
    ^~{.+~}\s+?
    Unfortunately, it bolds everything through the next right quotation mark. (See sample below).
    What can I add to the expression to restrict the GREP to find just the first set of quotes? These would be titles that may have multiple words or numbers in the title.
    Thanks in advance!
    “Images,” a 90-minute comedy-drama with music “dealing with real life issues, which is common to all, this play moves us and heals us all in an entertaining way,” says the Rev. Janet Jones. Presented in honor of Black History Month. Written and directed by Carmen Davis of Head of My Life Productions.  A.M.E. ZION CHURCH, 584 Bloomingdale Rd., Rossville; 732- 939-2885 or 718-356-0200. Feb. 8, 2 p.m. ($20 at the door) and 5 p.m. ($25). The latter show offers a post-show reception and meet-andgreet with the cast. For more infomation, call the numbers above or visit rossvilleamez@verizon. net.
    ——Mike

    If you want to use GREP, try this one:
    ^".+?"
    or delete the space from yours
    ^~{.+~}
    I can't say why, but your expression worked as soon as I took the space out of play.
    I used the expression below, which i thought would start at the beginning of a paragraph (^), left quotation mark (~{), any character, any number of times (.+), followed by a right quotation mark (~}), followed by a space (\s), zero or one times, shortest match (+?).
    ^~{.+~}\s+?
    Unfortunately, it bolds everything through the next right quotation mark. (See sample below).
    What can I add to the expression to restrict the GREP to find just the first set of quotes? These would be titles that may have multiple words or numbers in the title.
    Thanks in advance!

  • How can I use a script in a Livecycle Designer form, to force display of text in Title Case?

    Hello,
    I am a 'novice' who is DIY'ing the construction of a dynamic pdf form, using Adobe Livecycle Designer 7 (I know, it's a VERY old version!)
    [So, any help that comes along must be 'for Idiots'!]
    I need to construct a code (Java script?) so that a few of my text-fields DISPLAY data in Title Case - IRRESPECTIVE of how the user types in the data.
    So, for example, in a "Address" text-field...
    If someone types in ..
    "205 sherborne avenue"
    - OR -
    "205 Sherborne avenue"
    - OR -
    "205 SHERBORNE AVENUE"...
    I need the data to be DISPLAYED ESSENTIALLY as...
    "205 Sherborne Avenue".
    I found the following code online, and tried it in the 'exit' event of the field I need to modify (with 'language' selected as JavaScript)...
    <   this.rawValue = this.rawValue.replace(/\b([a-z])/g, function (_, initial) {return initial.toUpperCase();});   >
    ... This did convert all the 'initial' letters of the words to Upper Case - AS LONG AS they were not ALL typed in Upper Case!
    So, that code worked for the first two of my samples for Sherborne Avenue above - but it did NOT work for the last one...
    That is, "205 SHERBORNE AVENUE" did NOT get converted to Title Case - which is what I need help with.
    Thanks in advance...

    Hey TundraSteve,
    Thanks a tonne!
    Works perfectly!!!
    In fact, your solution is so elegant and direct, that even I am beginning to get a sense of how it works... I have looked at LOTS of similar codes in the past few days, but was not at all getting a sense of how they are working! But comparing your solution with the earlier one I mentioned, I am beginning to get a sense of things!
    Any suggestions for what I should read-up in order to understand this king of coding?
    I have basically been using the built-in 'Help' - and, trial-and-error - and I have designed my first form - a pretty elaborate one, actually!
    So, it would be great if you could guide me through the 'learning curve' a bit!
    [I have figured-out the 'basics' - that is, I can lay out the form, use 'if-expressions' (FormCalc), trigger events, even build Subforms that are hidden but 'appear' when triggered by other actions, and so on. What I can't figure out are the various 'code languages' (syntax?) that are being used - like " var sometext", for eg.!]
    Cheers, and thanks again!

  • Title Case Indesign Script?

    I have paragraph/character styles set. But I need a script to change these to title case (currently all lower case). I know there is a script, but the only ones I have come across seem to be for CS5 or below. I'm currently on CC 2014. Any sources for this script?

    A lot of scripts do not depend on actual InDesign versions (if they do, it's usually only a limit for lower versions, not higher). Just try the one you got. If you get an error, you can use the Script Version Folder workaround:
    http://indesignsecrets.com/using-old-scripts-in-cs3.php
    That recently worked for me to run a troublesome CS5 script in the very latest version -- I did not have to find out the cause of error and somehow fix it!

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

  • GREP glyph find by CID/GID

    Using GREP, I can find glyphs by unicode value with this expression:
         \x{2022}
    Is there a similar GREP expression to find glyphs by CID/GID value?
    For example: I am using Poetica with alternates for the bullet character (unicode 2022). Each alternate has a CID/GID vale of 1050-1062
    In a paragraph style I'm tring to apply a character style to each of 12 alternates. Something like:
         apply style 1050  to text  \CID{1050}
         or
         apply style 1050  to text  \x{2022}\CID{1050}
    I realize I can just make a font, and probly will, but I was just wondering if it's possible.
    Thanks,
    Cam

    No, the only way of using GIDs is with the Find/Change Glyph field in the Find dialog. And then it's the *only* option -- change one glyph to an other, nothing more, nothing less.
    Only way of doing it "smarter" I can think of is building thse parts of your file as InDesign Tagged Text -- export a portion of your formatted text to Tagged Text to see what this it looks like.

  • Title Case - is it possible?

    I have a client who wants a lot of content on his web site put into title case (i.e. all caps but with first letter of each word larger). The only way I can think of is to set a larger font size span for the first letter ... I am dreading doing this, it would be soooo fiddly and clunky. There must be way I can define a style, but I haven't been able to find one ... Anybody have an idea of how to do this?
    thanks!

    You can try using a small-caps style along with text-transform:capitalize, e.g.,
    .caps {
         font-variant:small-caps;
         text-transform:capitalize;
    <p>this is a test <span class="caps">of the small caps when used with a capitalize transform</span>. Is it working?</p>

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

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

  • Looking for a simple way to convert a string to title case

    New to LiveCycle and Javascript.  Looking for a simple way to convert a string to title case, except acronyms.  Currently using the the following, it converts acronyms to lower case:
    var str  =  this.rawValue;
    var upCase = str.split(" ");
    for(i=0; i < upCase.length; i++) {
    upCase[i] = upCase[i].substr(0,1).toUpperCase() + upCase[i].substr(1).toLowerCase();
    this.rawValue = upCase.join(' ');

    Thanks for the reply.
    Found the following script in a forum, which works fine as a "custom validation script" in the.pdf version of my form.  However, it will not work in LiveCycle?  The problem seems to be with
    "return str.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g"
    function toTitleCase(str) {
    var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
        return str.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title){
    if (index > 0 && index + match.length !== title.length &&
      match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
    (title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&
    title.charAt(index - 1).search(/[^\s-]/) < 0) {
    return match.toLowerCase();
    if (match.substr(1).search(/[A-Z]|\../) > -1) {
      return match;
      return match.charAt(0).toUpperCase() + match.substr(1);
    event.value = toTitleCase(event.value);

  • Find/Change Grep only finds one instance per paragraph, where am I going wrong?

    Hi,
    I've been using a Find/Change Grep to find any price with a comma and change that comma to a thin space (Newspaper's editorial style).
    But the Grep only finds the first instance of this per paragraph.
    Sample text...
    "$200,000 $200,000 $200,000.
    text at start of paragraph $200,000
    $200,000 text at end of paragraph
    tab     $200,000."
    In the sample the grep would miss the second and third price on the first line.
    I've been using...
    Find...
    (?<=\$)(\d{3})\,?(\d{3})
    also tried (\$\d{3})\,?(\d{3})
    Change to...
    $1~<$2
    Is there anything I can add to find these last two prices?
    I've been using this in combination with Batch Find Replace script, so different greps are set up for 5,6 and 7 digit numbers that start with $.
    Thanks.

    Try this,
    Find what: (?<=\x{0024})(\d{3})\,?(\d{3})
    Change to: $1~<$2
    Vandy

Maybe you are looking for

  • Multiple copies of the same podcast?

    Why do I get multiple copies of the same podcast with different episodes in iTunes?  Is there a way of merging them into a single podcast?  On my iMac, I may delete some episodes and add others.  When syncing with my iPhone, a new podcast is created

  • Windows  process showing up on pc free LAN - hacked? router? printer?

    In our firewall log we can see a samba connection being made from an ip on our LAN - we have no windows pcs or vritualisation software running. Our firewall is set to allow AFP + printer sharing. There is a wireless network so could someone have hack

  • Why can't I connect to a new wifi?

    Why can't I connect to a new wifi? When I click on the wifi account it takes me to the IP Address page not the password page.

  • Can my IMac read a 3" DVD-R from a Camcorder?

    Can my mac read a 3" DVD from a camcorder? I'm afraid if I insert it that I won't be able to get it back out.

  • To switch between map layers

    Hello, I have several layers at my map and would like to switch some of them if necessary. This is because sometimes the objects overlap each other and total picture doesnt look impressive Can somebody give me the necessary code? I found one on this