[JS CS3] Grep difficulty

Hi,
I succeeded creating a grep pattern which is used for a string replacement.
var myRegExp = new RegExp ("\..-.*.indd")
if the string is like this, it runs very well :
var x = "001296.01.A-ATELIER GLOTIN.indd";
but like this, it's not satisfying :
var x = "001296.01.ABC-ATELIER GLOTIN.indd";
I cant't get a grep search for a dot, any character n times, a dash, any character n times, a dot, and indd string.
if I do this, var myRegExp = new RegExp ("\..*-.*.indd"), it removes almost everything in the string
What I do wrong ? I am seraching on all grep sites but can't find any clue.
Thanks for light, Loic

Hi Peter,
Thanks for help,
It runs as you may expect it ;-)
For a developpement profane such as me, Grep appears as powerful than mysterious.

Similar Messages

  • [CS3] GREP-Problem with Anchored Objects

    Hi,
    I've the following problem:
    Lines beginning with a, b, c etc. should be formatted equally, so I use the following GREP:
    Search:
    ^([a-z])(\.??)([ \t])
    Replace:
    $1.\t
    Now there are some abc lines, which begin with an anchored object, so I tried:
    Search:
    ^(~a*?[a-z])(\.??)([ \t])
    Replace:
    $1.\t
    But with this, the anchored object is deleted. Is this a bug or am I doing something wrong?
    Thanks
    Tobias

    That's a known bug -- Dave Saunders discovered it, to his surprise, I might add. There seems to be no reason for it.

  • [CS3] GREP question

    I am using the following code to find all compound words:
    (\w\w+)-(\w\w+)
    However, if the first word has initials, such as "U.S.-China," it does not find it.
    So I change the code to be:
    (\w(.?)\w+.?)-(\w\w+)
    This works. Now GREP finds any compound word whether or not there are initials but when there are no initials it also selects the last letter of the word prior to the compound. For instance what is in brackets here is selected:
    th[e mid-September]
    Why is this happening and how can I fix it?
    Thanks,
    Tom

    Tom Tomasko wrote:
    [...] However, I found that following also works:
    ([\w+.*]+)-(\w+)
    Yes it will work, and as a side effect ... it will also pick up '+' and '*' !
    A list of characters inside [ Character Set brackets ] loose the magical properties they have outside them. \w is still regarded as 'any word character' (0..9, A..z, and the equivalent in other scripts), but the period does not longer match "any character" but only itself. There is no need to grab more characters using either + or * because anything inside the Character Set brackets always will match one single character, and you need the '+' right after it to get it to repeat.
    So all you need is this:
    ([\w.]+)-(\w+)
    WhatTheGrep's breakdown:
    ( Begin Group #1
    [ Inclusion: any character in this group
      \w Any word character (A..Z, a..z, _, 0..9)
      . The character “.”
    ] End Inclusion Group
    + Any character in this group may occur once or more times; longest possible match will be taken
    ) End Group #1
    - Literal character “-”
    ( Begin Group #2
    \w+ Any word character (A..Z, a..z, _, 0..9); may occur once or more times; longest possible match will be taken
    ) End Group #2
    (1[\w.]+1)-(2\w+2)

  • [CS3] GREP search first ocurence only

    Hi!
    I have an alphabetical list:
    Asdfg
    Awert
    Bsdfg
    Bwsd
    Csdfg
    Cwsd
    etc
    Is it possible to grep search first occurrences of A:s, B:s, C:s etc and then apply some formatting?
    ie search first line that starts with A, apply formatting, ignore following lines witch start with letter A and search first line that starts with B, apply same formatting...
    Thanks

    Oh allright, this one sets the paragraph style "Index head" as well.
    nextpar = app.activeDocument.selection[0].paragraphs[0];
    do
    nextletter = nextpar.contents[0].toUpperCase();
    nextpar.insertionPoints[0].contents = nextletter+"\r";
    nextpar.insertionPoints[0].appliedParagraphStyle = "Index head";
    while (nextpar.contents.length > 0 && nextpar.contents[0].toUpperCase() == nextletter)
      if (nextpar == nextpar.insertionPoints[-1].paragraphs[0])
       exit(0);
      nextpar = nextpar.insertionPoints[-1].paragraphs[0];
    } while (nextletter < "Z");
    It's surprisingly slow, on a 3 column/4 page index... but it still beats doin' it manually, 'cause you can sit back and clean your fingernails or something like that.

  • CS3: grep search to replace part of a string

    Can I do a grep search for a string of text but only replace a portion of the string while leaving the remainder intact?
    iMac G5, OS 10.5.5

    In addition to Eric:
    Find "some search string", Replace "some replacement string " also replaces part of the string, not touching anything...
    But the GREP search has two advantages: First, if you define formatting in the Replace field (italics, superscript, a character style), only the 'search'/'replacement' part will be affected, rather than the entire found string (as in regular search).
    The second big advantage is you can use any regular GREP single character wildcard in the 'left' and 'right' (matching-but-not-marking) parts. A few useful examples: '\d' (digit), '\l' and '\u' (lowercase and uppercase), '.' (any character), or even '[a-f]' (lowercase 'a' to 'f'). The only limitation is that you cannot use the once, zero-or-more, or once-or-more modifiers -- the strings must have a fixed length. FYI, those three modifiers are, respectively, ?, *, and +.
    This restriction does not apply to the 'middle' string, the one you are going to replace anyway -- use whatever GREP you want.

  • Compatibility between CS3 and earlier versions?

    As the web developer I have Contribute version 3, but some of
    my new clients
    will be buying the latest Contribute CS3 to update their site
    pages. Can I
    still set up their roles and editing rights for a site and
    create a
    connection key to send to them that will work for them in
    Contribute CS3
    without difficulty? And can either of us still edit the site
    pages,
    regardless of the fact that we are each using different
    versions of
    Contribute?
    In conclusion, are there any backward compatibility issues I
    should be aware
    of between the newer version and older versions of CS3 when
    administering,
    and connecting to, the same website?
    Thanks in advance.
    (Please reply to forum. E-mail address is bogus to prevent
    spam)

    Thanks for the advice.
    "ThinkInk" <[email protected]> wrote in
    message
    news:f0sa43$dvh$[email protected]..
    >I had the same problem when C4 arrived and I could'nt
    purchase C3 for my
    > clients.
    >
    > The key is to use Transitional Mode (adminstrator
    settings,
    > compatibility),
    > here's wat the HELP says:
    >
    > --------------------------
    > Enabling compatibility with older versions of Contribute
    > Contribute 4 offers administrators two compatibility
    options--one that
    > allows
    > users with earlier versions to work on the website, and
    one that does not:
    >
    > Transition Mode
    > In this mode, users of earlier versions of Contribute
    can continue working
    > on
    > the website, along with Contribute 4 users. This lets
    you evaluate the new
    > version and set up new roles and permissions without
    disrupting users with
    > earlier versions of Contribute.
    >
    > Compatibility Mode
    > In this mode, all users must use Contribute 4. Users
    with earlier versions
    > cannot work on the website.
    >
    > Contribute 4 starts in Transition mode by default when
    you migrate from
    > Contribute 3. Use this mode temporarily; when you?re
    ready, transition all
    > users to Contribute 4 and enable Compatibility Mode.
    >
    > To enable Compatibility Mode:
    > In Contribute 4, select Edit > Administer Websites,
    and then select a
    > website.
    > The Administer Website dialog box appears.
    >
    > Select Compatibility from the category list on the left.
    > The Compatibility options appear in the Administer
    Website dialog box.
    >
    > Select Compatibility, and then click Close.
    > After you enable Compatibility Mode, all users connected
    to the website
    > must
    > use Contribute 4.
    >
    > ------------------------
    >
    > It's really better to upgrade yourself to the newest
    version, so you know
    > what
    > extra options your clients have and you can support
    them. I managed to get
    > both
    > C3 en C4(I purchased the upgrade) running on my PC, so
    maybe that's also
    > an
    > option.
    >
    > grtz. Hayo
    >

  • CS3 Activation post Repair

    Hi all.
    I've been running CS3 without difficulty for about a year. My Macbook was in for repair due to a known graphics card issue. This was accepted by Apple as a post warranty issue and they replaced the main board on the machine.
    Since then, CS3 will not open, and it states that the install needs reactivation. Now, I have this install on my work PC also, and this activation still works.
    This makes sense, 2 installs - within license.
    The problem is that I now have a dead activation on the laptop as the serial number of the main board is different and presumably CS3 thinks this is an additional machine.
    When I go to the adobe website and look for details on how to get a repair activation, the pages go in circles - look try it yourself....
    http://kb2.adobe.com/cps/514/cpsid_51483.html#toomany
    this leads to a link to 'Contact Adobe Customer Support' link -
    which takes you to here....
    http://www.adobe.com/products/activation/
    which gives no contact information but offers a link back to - you guessed it ... the page you were just at....
    I've tried calling in Ireland but nobody seems to be home...
    Any ideas?
    Ciaran

    call the activation line at 800-603-6805.

  • Flash tool Problems

    Using CS3
    Technical difficulty questions:
    Why is is that the pen tool will sometimes at random suddenly look like a thicker line size when the tool hasn't been tampered with at all? This does not have to do with the effect of Zooming out and noticing how the line tool thickens.
    Why is it that when setting up hotkeys that the program not only fails to remember right after editting/ or saving your hotkeys, but also, starts to shuffle the hotkeys to other already used hotkeys (this is something that flash is doing with all the computers in the studio I work in)  It usually will take me 4 - 5 tries of resetting all of the hotkeys I've organized just because  I wanted to add a new hotkey. Is there something to prevent this, or a reason why this happens?
    At random again, there are times when tweening a symbol, it automatically syncs itself, which really screws things up if you are using single frames in the animation. (because as we all know, the syncing option automatically sets the tweened animation to be the same frame instance as the previous keys if it is single framed) How do you solve that problem because unsync options doesn't really help when you literally have to go to each key pose and indivually reset the frame instance to the frame you wanted it at originally before having tweened it.
    Just mechanical questions:
    I've been trying to deal creating masks for eye symbols my problem is that after creating 50+ different instances of an eye blinks/expressions I want to be able to copy this entire symbol and just rename it, while keeping all the instances of these eye blinks and shapes exactly in the same place as the original eye blink symbol.  So copying the frames inside the symbol and just pasting them into a newly made symbol doesn't help because pasting and then turning it into a symbol the usual way creates problems like the size of all these eye blinks become too big/small/ or all too far too the left/right (which ultimately would force me to very carefully try to position the symbol over top of the original eye shape to match it perfectly to accomplish seamless masking. So my question is: Is there a simple way of duplicating a symbol so that it is unparented/doesn't effect the symbol that it was duplicated from.
    is there a way to change the default line options (ie: rather than always having at line width 1, join: rounded, cap: rounded)
    is there a way to change the 'J' hotkey ( when working it also happens to randomly switch to object drawing which gets very tedious when it's unwanted, weather I accidentally press the 'J' button or not when switching between the brush (B), Line (Y) or straight line (N) tools (and others)) I've checked hot keys trying to change it, but it doesn't seem to be an option available to change it to another hot key.

    I can't answer all your questions, but I'll tell you what I can about the ones I know a bit about.
    Why is it that when setting up hotkeys that the program not only fails to remember right after editting/ or saving your hotkeys, but also, starts to shuffle the hotkeys to other already used hotkeys (this is something that flash is doing with all the computers in the studio I work in)  It usually will take me 4 - 5 tries of resetting all of the hotkeys I've organized just because  I wanted to add a new hotkey. Is there something to prevent this, or a reason why this happens
    This seems to only happen to me if I'm assigning a hot key that was already used to something new. This seems to "shift" all the hot keys that followed the original hot key. The solution is that when you get a warning that the hot key was previously used, pick something else. This kind of sucks if you really wanted that hot key, but that's the only thing I have found that works.
    Just mechanical questions:
    I've been trying to deal creating masks for eye symbols my problem is that after creating 50+ different instances of an eye blinks/expressions I want to be able to copy this entire symbol and just rename it, while keeping all the instances of these eye blinks and shapes exactly in the same place as the original eye blink symbol.  So copying the frames inside the symbol and just pasting them into a newly made symbol doesn't help because pasting and then turning it into a symbol the usual way creates problems like the size of all these eye blinks become too big/small/ or all too far too the left/right (which ultimately would force me to very carefully try to position the symbol over top of the original eye shape to match it perfectly to accomplish seamless masking. So my question is: Is there a simple way of duplicating a symbol so that it is unparented/doesn't effect the symbol that it was duplicated from.
    For this, I use Swap Instance for Duplicate Symbol. Usually I already have an instance on stage that I want to use this on, but sometimes I'll just drag one on and run the command, since it works so much better than duplicating the symbol in the library. Once I have a duplicate symbol, then I can go inside it and swap any inner instances for duplicate symbols all the way down until I've finished my edits.

  • [CS3 JS] How to search for accented letters with GREP

    Hello,
    In the following script I have two words, each that has an accented letter. It appears that neither in the script nor in the Find and Replace dialog that GREP will recognize words with accents. It will replace accented characters however. I can do a search for words with no accents but that will lead to trouble when I only want to change the word if it has an accent.
    Any advice would be great!
    Tom
    var myDoc = app.activeDocument;
    var rawWordsAccented = ["André","Barrës"]; //find these words
    var rawWordsAccentedDHyphens = ["~-Andr\\x{00E9}","~-Barr\\x{00EB}s"]; //replacement words
    for(var k =0; rawWordsAccented.length > k; k++){
        var numWords = theGrepChanger(myDoc,rawWordsAccented[k],rawWordsAccentedDHyphens[k]);   
        }//end for k
    function theGrepChanger(docRef,grepFindIt,grepChangeIt){
        app.findGrepPreferences = NothingEnum.NOTHING;
        app.changeGrepPreferences = NothingEnum.NOTHING;
        app.findGrepPreferences.findWhat = grepFindIt;
        app.changeGrepPreferences.changeTo = grepChangeIt;
        var arrGrepFindIt = myDoc.changeGrep();
        return arrGrepFindIt;
    }//end theGrepFinder

    John, perhaps it works in CS5 but not in CS3.
    Peter, the problem is not in the replacement word or looping through that array backwards or forwards. The problem is finding a word with an accented character using the GREP mode.
    In using the Find/Replace dialog I cannot find André. Nor Andr\x{00E9}, using Unicode. So if the dialog won't work it appears a script won't work. If I use "Andre" in the Search field it will find "Andre" and "André."
    However I did find that if I change the GREP function in the script to the text mode I can find only words with accented characters and then replace them to my heart's content.
    Tom
    function theTextChanger(docRef,textFindIt,textChangeIt){
        app.findTextPreferences = NothingEnum.NOTHING;
        app.changeTextPreferences = NothingEnum.NOTHING;
        app.findTextPreferences.findWhat = textFindIt;
        app.changeTextPreferences.changeTo = textChangeIt;
        var arrTextFindIt = myDoc.changeText();
        return arrTextFindIt;
    }//end theTextChanger

  • Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it o

    Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it on my computer registered?

    If your two activation are in use you need to call Adobe. Install CS3 to to point of activation and call Adobe at that point.  They have help me in cases like your My Disk crashed and I replaced it. Could not deactivate the crash activation.  I done that twice over the years I've been using  PS for around 20 years
    To see your key you need to click on the product in your Adobe products and services page.

  • CS4: How to load GREP styles from CS3?

    I imagine there must be a way to get my many custom GREP searches into CS4, but I know not how. Anyone know?
    Thanks in advance,
    Aaron

    Go to your InDesign CS3 Preferences folder (in Home > Library > Preferences > Adobe InDesign > Version 5.0) and you'll find a folder called Find-Change Queries. In there will be a GREP folder with your saved custom searches. Each saved search is a small .xml file.
    Copy those XML files and then paste them into the same place for your CS4 Preferences: Home > Library > Preferences > Adobe InDesign > Version 6.0 > en_US > Find-Change Queries > GREP.
    You don't need to quit out of either program to do this, as soon as yo paste in the GREP files they'll appear as options in the Find/Change dialog box.
    AM

  • GREP Commands from CS3 to CS6

    Hi All
    we got some GREP tags which we copied from InDesign CS3 to InDesign CS6. Is it possible that those tags don't work anymore? we use [[:punct:]] for example, but InDesign don't recognize the input...
    Did Adobe made changes in CS6 the GREP process?
    Thanks for your support!
    Reto

    retogreub wrote:
    tried but no success... i just don't understand why the GREP doesn^t work anymore.. here's the string:
    (\d+[[:punct:]])\t(.+\t)(\d+\t)(\d+\t)(\d+\t)(\d+[[:punct:]]\d+\t)(.+)
    with this table:
    1.     Basel     19     9     9     1     35     :      18     36
    GREP find's 1 but the point isn't recognized by [[:punct:]]
    Your Grep cannot work for you.
    Try this instead (if you need every part alone):
    (\d+[[:punct:]])\t([^\t]+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)([[:punct:]]\t\d+\t)(\d+)
    or this (will find the same):
    (\d+[[:punct:]])\t(\w+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)([[:punct:]]\t\d+\t)(\d+)
    or this:
    (\d+\.)\t(\w+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)(\d+\t)(:\t\d+\t)(\d+)

  • GREP search for single line paragraphs, CS3

    I need to find all single line paragraphs, apply a paragraph style to them and apply that style's "next style" to the next paragraph.
    Is there any way to do this using GREP?
    Thanks

    This script will do what you ask. Just change the name of the head paragraph to whatever yours is in line 11:
    //DESCRIPTION: Apply Head Style to single-line paras with Next Style in Selected Story
    (function() {
      if (app.documents.length > 0 &&
            app.selection.length == 1 &&
              app.selection[0].hasOwnProperty("baseline")) {
      var myStory = app.selection[0].parent;
      var myParas = myStory.paragraphs;
      for (var j = myParas.length - 1; j >= 0; j--) {
        if (myParas[j].lines.length == 1) {
          myParas[j].appliedParagraphStyle = "H1";
          try {
            myParas[j+1].appliedParagraphStyle = myParas[j].appliedParagraphStyle.nextStyle;
          } catch(e) {} // last para has one line, so ignore
    } else {
       // No document open
       alert("Please select some text and try again.");
    To use the script, copy it from here into an ExtendScript Toolkit document (you'll find that in the Adobe Utilities folder). Save the document into an appropriate folder and run the script from the Scripts panel with a live insertion point in the story.
    To work out where to save the script, open the Scripts panel and then use Reveal in Explorer to find the User Scripts Panel folder.
    If your heading style isn't at the top level in your Styles panel, temporarily move it there.
    Dave

  • Difficulty Installing CS3 on New Imac

    Clean install of system and still cannot make the installation work. Is there a problem installing CS3 on later versions of 10.5.x?

    there should not be a problem.

  • Odd GREP results (CS4 Mac, CS3 PC)

    Hi all
    I'm using a series of expressions strung together in a JavaScript to format the copy supplied for a Contents page. The copy is supplied as basically a list separated by returns, eg;
    Jeremy Smith
    Made Up Name, National Gallery, London
    Brian Smith
    Blah blah blah, I like cheese
    and I am using GREP to format it as follows;
        (tab)    Jeremy Smith          (tab)         Made Up Name, National Gallery, London         (tab)              00
        (tab)    Brian Smith             (tab)         Blah blah blah, I like cheese                           (tab)               00 
    My expressions recognise the first line (the name) and the article title and store them as "found text" and then spit them out again with the returns deleted and replaced with the appropriate tabs;
    Find what: ([\w [:punct:]]+)(\r)([\w [:punct:]]+)(\r)
    Change to: \t$1\t$3\t00  (00 being the placeholder page number)
    This does work but what happens is the found text is not output as it is found - the italic is not correct. The above example comes out as;
        Jeremy Smith    Made Up Name, National Gallery, London    00                   (incorrectly formatted letter in red)
        Brian Smith    Blah blah blah, I like cheese    00
    The above expression is one of many I run on this page but I have extracted this out and tested it on its own and it is this expression that is causing the problem - I can't see what the hell is happening! These are other examples of where it happens but hopefully the above example will be enough to give the resident GREP experts enough to go on if they are kind enough to give it a look.
    Any suggestions appreciated.
    thanks,
    Iain

    Eugene - you're right, making all the punctuation italic first gets round the problem. But it has made the last letter before the punctuation in a roman phrase italic. I don't think I can use that method in our job anyway as it can't all be changed back to the same style (bold or italic etc). The formatting of the page is such that punctuation could appear in either bold or bold italic so a general "make all punctuation italic and then back to roman again" wouldn't do it.
    I suppose I could change all the punctuation following an italic character to italic and red and then do my main GREP and then put all the red punctuation back to roman (and black) - which means when we apply the paragraph style it shoudl all work out. I'll give that a try after lunch.

Maybe you are looking for