GREP Oddity

Every time a GREP doesn't work as expected, it is an oddity until someone who knows explains. Here's what I had set up for a GREP style. I have a character style named AllSmallCaps which simply assigns the AllSmallCaps Open Type feature to the text. I wanted to apply it to all words of two or more characters that are set in all caps (the paragraph styles in question use Minion Pro, so the style will work if the GREP works). I started out with:
\<\u\u+\>
and that works. But then I ran into cases where a word had a hyphen in it and another had an underscore, so I changed my GREP to:
\<\u[\u_-]+\>
and that also works. But next I realized that I wanted this to work for mixed number/letter combinations (as long as they start with a letter). So I tried:
\<\u[\u_-\d]+\>
And, not only did that not work, it caused "Pa" to be converted to small caps. I've changed my GREP to:
\<\u[\d\u_-]+\>
And that works properly. Perhaps there's some rule that says if you're including wildcards in a square bracketed list they must be at the head of the list, but I don't understand how that second to last version caused "Pa" to be changed. Any GREP experts handy?

The hyphen causes the problem.
>[\u_-\d]
is "upper case and everything inbetween "_" and "\d", just as
>[a-z]
is "everything between "a" and "z". The common workaround is placing the hyphen either first or last in the selection braces.
Granted, it does not explain why lower case characters fall between underscore and digits. Must 've something to do with the internal workings.

Similar Messages

  • GREP search for \$ Dollar sign doesn't find them all?

    Hello,
    OK-I was practicing my GREP yesterday and was working with escaping out characters. Since the $ could not be found, I assumed it needed to be escaped out \$. The odd thing is, when I say find next, it skips many of them in the document?
    Anyone know why?
    thanks!
    babs

    This has been reported before; it's an oddity of ID's implementation of GREP. Nobody knows why! (*)
    It only works reliably when you do not use the escape code \$ (you were, in fact, correct to try that first!), but instead use the Unicode notation for a dollar sign: \x{0024}.
    I've noticed some strange GREP-related behavior myself: at times, it seems "Find Next" can skip a *huge* quantity of text and finds something near the end of the file; but a next "Find Next" mysteriously jumps back to the previous find position, and continues from there as if nothing happened.
    (*) I'm pretty sure it's the Adobe engineers that are responsible for this. According to Peter Kahrel, Adobe didn't write the GREP module by themselves but chose to use a free programming library called "boost". Now boost is an extremely thorough piece of work that has gone through literally years of development and dozens, if not hundreds of programmers (probably unpaid as well, since boost is open source), and I cannot imagine something like this to slip through unnoticed.
    But ... for InDesign, the Adobe programmers had to add code to cater for InDesign's own special characters and codes -- stuff like the special characters and spaces, and text variables. It's not hard to imagine a programmer accidentally changing a line of code that did the, erm, "now search for \$" stuff.

  • Finding Both ( and ) open and closed as the same time in grep

    Hi,
    I have a character style I want to apply to all the () in my document.
    In the GREP area, the drop down shows I can select one at a time and make the change.
    Is there a way to find both at the same time regardless of how many characters are in between?
    thanks
    babs

    Hi Rodney,
    I have an update here.
    Ok-so yesterday everything worked great...
    Today, it's acting very weird.
    I am using the same find and change GREP I used yesterday: To find the (or)
    And i am changing it to the character style I made with the baseline shift change. It worked perfectly yesterday, and now it's deleting the ()????
    I thought maybe the document might be corrupt, so I made a new one and tried it and this was even worse. I had a bunch of () in the file and asked it to find in the GREP  [\(\)] and change to a character style I made and it told me it could not find any?
    Even if I chose, document, all documents selection, story, nothing worked???
    I trashed all the InDesign Prefs but still no go.
    Is this GREP stuff really that buggy or do you think it is something with my software and machine? If you have never seen anything like this, then I will throw up a new forum and try to find out if outers ahve problesm with this stuff.
    thanks!!
    babs

  • Grep command in Solaris 10

    Hi all,
    I linux i can use this command
    grep -C 3 err /u01/oracle/admin/ORCL/bdump/alert_ORCL.log
    How can i do this in Solaris 10?
    Thanks in advance!
    Dan.

    This work perfectly!
    -bash-3.00$ /usr/sfw/bin/ggrep -C 3 err /u01/oracle/admin/ORCL/bdump/alert_ORCL.log
    Thank you all!
    Dân
    Edited by: Dan on Jan 9, 2012 10:36 PM

  • Cross reference + GREP + excluding text

    I would like to know if anyone has a solution to the following problem.
    I have a paragraph style which I use to label tables within my document. In the paragraph style I have set up numbering (under Bullets and Numbering) so that each heading appears as "Table 1.1 School Children in HK" or "Table 1.2 School Children in China" the code I have entered in the 'number' field of the paragraph style appears below:
    Table ^H.^#^/
    I have inserted the word 'Table' prior to the rest of the code so that the label is correct.
    When I create cross references I select 'Cross Reference Format' to be 'paragraph number' the problem is, however,  that the word 'Table' is picked up as part of the 'paragraph number' because of the settings in the Paragraph Style. The end result looking like this:
    The result is fine if you are cross referencing a single table per sentence, however, if you are dealing with multiple tables in plural this is a problem. What I would like to achieve is this:
    Does anyone know if there is a way to achieve this by editing the 'Cross Reference Format' so that the word 'Table' disappears when the cross reference is generated? Perhaps with GREP?
    I would really appreciate your help.

    Hi Tom,
    Im following standard English conventions (UK, if you will)  and the format at the moment is a wee bit clunky when you have to write something like 'Table 7.1, Table 7.2, Table 7.3, Table 7.4 and Table 7.5.....' as will be the case later in the document. The other arrangment of 'Tables 7.1, 7.2, 7.3, 7.4 and 7.5.....' is much shorter and easier to read - brevity is essential in this document because of limited word count.

  • More help with GREP needed

    I have been attempting to create some nested styles.
    So far, I am getting the hang of it.
    I have created a grep style that will make all text after the word "NOTE: " into italic. Also, I have grep style that makes all text that is "FIGURE +\d+\d" into bold text.
    The problem I have is that if the word "FIGURE " etc. is in the italicized note text, then it will not become bold.
    For example: "Operate the switch to begin the process (FIGURE 3-3). Make sure guards are closed (refer to FIGURE 3-1)."
    That works fine, and "FIGURE " is bold. However, when I change the sentence by adding "NOTE: Make sure guards... " it all becomes italic, and I loose the bold on "FIGURE 3-1"
    So, is there a way to augment my italic grep with some kind of inclusion... as if I were saying "if "FIGURE +\d+\d" make that is bold italic"
    sorry for the long-winded attempt to describe what I want to do.
    Thanks in advance for help.
    RPP

    RPP,
    The trouble is that in GREP style you can find text but not formatting, so you can't say something like "find FIGURE only when it's italic". In the Find/Change dialog you can, but in GREP styles you can't.
    You also can't say "look for FIGURE if it's preceded by NOTE: and any characters in between". Unfortunately, lookbehind can't cope with variable-length text. So if you always have "NOTE: Refer to FIGURE ...", then you can use lookbehind and you set-up would be this:
    apply italic to FIGURE [-\d]+
    apply bold to NOTE:.+
    apply bold-italic to (?<=NOTE: Refer to )FIGURE [-\d]+
    The first parenthetical is a lookbehind: in this case, FIGURE looks behind, meaning you find FIGURE only when it's preceded by "Note: Refer to", which is not matched itself. So bold italics would be applied only to FIGURE [-\d]+, and only when preceded by ...
    But you're not likely to have such fixed text. When you have just a few alternatives, you can list them as alternatives, so if you always have "Note: Refer to " or "NOTE: See " you could salvage your set-up, but with more than let's say three alternatives it gets messy.
    (?<=NOTE:.+? )FIGURE [-\d]+ , which you would hope would match any text from NOTE: to FIGURE, doesn't work as a lookbehind.
    Peter

  • ID-CS4 -JS - - Can't find using Grep options - Reg.

    Dear All,
      Here I have a doubt about the "Find / Change Grep" in InDesign CS4.
    I can find the "Force Line Break" using the Grep options : ([a-zA-Z]*)-\\n([a-zA-Z]*)]
    Some time this Grep is working, some time this is not working ...
    I don't know what I made the mistakes. Please let me know any one can suggest and modify the below coding.
    I supposed to close and re-open the InDesign CS4 and ExtendScript tool, then First time this Grep is working fine...
    So I confused this. Please any one can give me a solutions.
    //================= Coding ==================//
       var myDoc=  app.activeDocument;
           app.findChangeGrepOptions.includeFootnotes = false;
           app.findChangeGrepOptions.includeHiddenLayers = false;
           app.findChangeGrepOptions.includeLockedLayersForFind = false;
           app.findChangeGrepOptions.includeLockedStoriesForFind = false;
           app.findChangeGrepOptions.includeMasterPages = false;
           app.findGrepPreferences.findWhat = "([a-zA-Z]*)-\\n([a-zA-Z]*)";
             mySearch = app.findGrep();
             for(var myForce =0; myForce<mySearch.length; myForce++)
              app.select(mySearch[myForce]);
              var mySel = app.selection[0];
               myConts = mySel.contents;
              app.select(mySearch[myForce]);
              var mySel = app.selection[0];
               myConts = mySel.contents;
              app.findGrepPreferences = NothingEnum.nothing;
               app.changeGrepPreferences = NothingEnum.nothing;
    //=============== End of the Coding ========================//
    Please any one can kindly help me....
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear Vaasu Devi,
      Many thanks for your reply...
    I found, where I mistaken....
    Here My Correct Code :
    //================= Coding ==================//
       var myDoc=  app.activeDocument;
           app.findChangeGrepOptions.includeFootnotes = false;
           app.findChangeGrepOptions.includeHiddenLayers = false;
           app.findChangeGrepOptions.includeLockedLayersForFind = false;
           app.findChangeGrepOptions.includeLockedStoriesForFind = false;
           app.findChangeGrepOptions.includeMasterPages = false;
           app.findGrepPreferences.findWhat = "([a-zA-Z]*)-\\n([a-zA-Z]*)";
             mySearch = app.findGrep();
             for(var myForce =0; myForce<mySearch.length; myForce++)
                        app.select(mySearch[myForce]);
                         myConts = mySearch[myForce].contents;
                         $.writeln(myConts);
              app.findGrepPreferences = NothingEnum.nothing;
               app.changeGrepPreferences = NothingEnum.nothing;
    //=============== End of the Coding ========================//
    app.select() is working fine, meanwhile, I get the selection of the contents. That time only its throw the Error message. So I used to divert, app.select and Select Value of Contents to pass the "myConts" variable then I will do the other funtions.... Now My this time I'm not getting the Errors...
    Thanks Once again
    Regards
    T.R.Harihara SudhaN

  • Trying to use grep from within java,using exec command!

    Hi all!
    I would like to run a grep function on some status file, and get a particular line from it, and then pipe this line to another file.
    Then perfom a grep on the new file to check how many of the lines above are present in that file, and then write this value to a new file.
    The final file with a numerical value in it, i will read from within java,as one reads normal files!
    I can run simple commands using exec, but am kinda stuck with regards to the above!
    Maybe i should just do all the above from a script file and then run the script file from exec. However, i dont want to do that, because it kinda makes the system dependent,..what if i move to a new machine, and forget to install the script, then my program wont work!
    Any advise?
    Thanks
    Regards

    With a little creativity, you can actually do all that from the command line with a single command. It'll look a little crazy, but it can be done.
    Whether the script exists on the local machine or not has zero to do with platform indpendence. You assumedly have to get the application onto the local machine, so including the script is not really an issue at all. However, you're talking about system independence, yet still wishing to run command line arguments? The two are mutually exclusive.

  • Doubt in GREP

    Hi ALL,
    Doubt in GREP:
    Working in Glossary, my requirement is upto first colon ":" i want to apply characterStyle after that give "Em Space".
    How can we find first colon or commo etc.
    I am using Zero or One Time

    1. I have never, ever, used Data Merge. Can you supply sample files and a written explanation of each of the eight items in the Data Merge menu? I can't promise I'll ever need it, but thanks anyway.
    2. Please, please, do not use the word "doubt" Ever Again. I seriously doubt you know how to use it correctly. Use "question" if you are in doubt about when to use it correctly. Thank you. (Should you doubt my knowledge of English, then you are correct -- I'm not a native speaker either. But as you can see practise obviosly makes perfect.)
    3. InDesign Help has all the proper help on GREP. It's right here: http://help.adobe.com/en_US/InDesign/6.0/WS1952D538-1335-4b1d-BA5E-FA5A176FDC9Fa.html and I got that by typing in "GREP" in the Help search box.
    4. Why would anyone need a file and a list of examples telling how to use these particular parts of GREP? It's rather the other way around: if you need something that cannot be done with a regular search, read the help on GREP (see above) and check if the functions and constraints for each of these match your requirements. If so, there are usage samples on the Help page; and if not, it probably cannot be done, or you are looking at it the wrong way.

  • Report S_ALR_87012993 issue: GREP blocks

    Hello experts,
    When I run report S_ALR_87012993 I get the following error:
    "Internal error: More then 999 GREP blocks were requested"
    Message no. GR215
    Diagnosis
    An internal error occurred in the Report Writer.
    When running the program, you selected the option to store your results permanently.  However, when the selected data was stored in blocks in the GREP file, the maximum number of blocks was exceeded.
    System Response
    The selection program was terminated.
    Procedure
    Inform your system administrator.
    You may have to increase the block size for the GREP blocks.
    Is there anyone who knows what the problem is and how it can be solved?

    The solution that worked for me was:
    1.-Implement note 64537.  Import transport request of the change to your productive client.
    2.-Regenerate report group using transaction code GR55 using report group 6O00.
    3.-Run report S_ALR_87012993 again and it will work.
    Best regards!
    Alex.

  • A Unix question: grep command

    Hi all,
    I have a directory which contains more directories, and each directory has more directories inside, which in turn may or may not contain Java files. I need to use the grep command in the way that from the first directory goes into the directories recursively, finds the Java files and tell me what files have the PATTERN= "Basic Import Validation".
    I used the grep like this, but guess its wrong since haven't received any response so far. Can sb. please tell me if I've used the command correctly or how should I change it? Any help is greatly appreciated.
    dir> grep -r --include="Basic Import Validation" *.java                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I gues the reason this isn't working for you isthat
    -r means "process all subdirectories of any
    directories listed in the command line args."
    grep never sees the *.java that you supply. Theshell
    grabs that and expands it to list all the .javafiles
    in the pwd.If you can, would you please explain a little more,
    what you meant by above?
    grep whatever *.java When you type that command, your shell (bash, zsh, ksh, tcsh, etc.) is the program that receives that string on its standard input--like Java's System.in. The shell sees *.java and expands it into a list of all the .java files in the current directory. Then the shell invokes grep, and passes on the list of those java files.
    But the list of .java files in the pwd has nothing to do with any java files that might be in subdirs.
    If you use the -r arg, it seems that, in the list of "files" (where you put *.java), if any of those "files" are in fact directories, then -r means to look in files in that dir and its subdirs, rather than treating that arg as a file to examine.
    So you'd put . (dot) as your current dir, and then use the --include to tell grep which files to process and which to ignore.
    I'm sure about the shell expanding *.java. I'm not completely sure about my interpretation of -r and --include, but I'm pretty confident that's right.
    As you said, the way I used grep, didn't return any
    result. Your solution however, gave me results and
    found the Java files containing the PATTERN. Thanks a
    lot.You're welcome.
    If you're still interested, it's probably worth trying out my slight modification to your original solution. If it works, it's a bit cleaner and simpler.

  • GREP: How can I place a (for example) "*" before and after bold text with GREP?

    Hi there.
    I have a string of text as such:
    I want to use GREP to insert a "*" (asterisk) before and after each bold part. Can I do that with GREP?
    (if asterisk is a problem, I can use a different character)
    Any help would be appreciated.

    Hi Schmaltzkopf,
    try this:
    Have fun

  • Forum oddity, w.r.t high resolution screen.

    I started a thread on Windows/ Photoshop entitled "CS4 with a high resolution screen". People have replied to this, according to e-mail direct response. However, it is not on the list of forums, and neither does it appear on 'search'.
    To repeat: we have a high resolution HP LP 3065 screen, which supports up to 2560 x 1600 pixels. At this resolution, images are still less than print size, but CS4 is essentially unusable because the menu text and other icons do not scale. Does anyone know if it is possible to manage this silly interface to allow the user to see what they are doing? Is there even a visual disability option? Even MS Office 2000 - ten years old - allows "large icons".
    If not, I think this is another way in which CS4 is in fact worse than CS3, which (mostly) used the Windows UI and which was therefore considerably more flexible. The screen in question is supported by dual DVI connections to an Nvidia FX3700 card - a CUDA multiprocessor device optimised for 2D images and CAD - and an eight processor, 3 GHz machine. With all of this processor power, CS4 is still much slower than CS3 on a single processor laptop. The paint follows the pen by several centimetres, like early Photoshop on a pre-Pentium processor.

    I started this by saying that through an oddity of this forum software, my original thread had vanished from the list. Exactly the same thing happened to this one, which i had to find through searching the forum list. The previous one vanished completely. One appears to get a different list if one comes in via a direct URL or via support > Forums > windows: an .asp error, presumably, but Adobe please note.
    Someone asked why use a high res screen. If you work on a large image, you either operate at the pixel level - a plate on a table top if you are at 1020 x 768 and working with a 20 megapixel image - or you shrink the thing down to fit. In the latter case, each pixel that you see is, depending on the native image size, an average of a large number of adjacent pixels. In the case of a 24Meg image and the above screen size, each visible pixel is an average (or however Adobe calculate it) of a bit over 20 pixels from the native image. If you look at 2560 x 1600 you are still seeing a composite, but of a quarter fewer source pixels per point. If you look at the natve image as 'actual pixels', the 'dinner plate' is four time bigger in proportion to that of the SVGA image.
    That said, imagine the layers pallet in which one layer has, let's say, a football set against an group of players , P/shop users will expect to see a black blob representing its position in the layer. At high resolution, however, the blob is represented on the screen by a patch that is smaller than a full stop on a page of type, and essentially invisible from 150 cm from the screen. Thus: squint, lean forward, mutter angrily.
    Why can one not set the icons and the ephemeral facilities such as the layers pallet to be any size you want? It is really very silly.

  • [AS] How to change a paragraph style within any folder in Find Grep?

    I want to change both text and paragraph style
    I do that job very easily until I put paragraph styles in a folder
    How to express the paragraph style "passage" within the folder "1st" in AppleScript?
    In line 18 below, "1st:passage" may be wrong... so I've tried and search for an hour, but I can't get the answer..
    sorry for bad english
    my main()
    on main()
      mySnippet_test()
      myTeardown()
    end main
    on mySnippet_test()
              tell application "Adobe InDesign CS5.5"
                        set myDocument to document 1
                        set find grep preferences to nothing
                        set change grep preferences to nothing
                        set include footnotes of find change grep options to false
                        set include hidden layers of find change grep options to false
                        set include locked layers for find of find change grep options to false
                        set include locked stories for find of find change grep options to false
                        set include master pages of find change grep options to false
                        set find what of find grep preferences to "\\n"
                        set change to of change grep preferences to "\\r"
                        set applied paragraph style of change grep preferences to "1st:passage"
                        tell myDocument
      change grep
                        end tell
      --Clear the find/change preferences after the search.
                        set find grep preferences to nothing
                        set change grep preferences to nothing
              end tell
    end mySnippet_test
    on myTeardown()
    end myTeardown

    Replace the red line with… Replacing name strings to yours…
    set myStyle to paragraph style "Style A" of paragraph style group "Style Group 1" of myDocument
    set applied paragraph style of change grep preferences to myStyle

  • IDCS5/MAC - GREP Style to uppercase a letter after a dash between words

    G'day there.
    I'm trying to create a GREP style to uppercase a letter after a dash between words, more specifically where one word starts with a capital and the one after a dash does not e.g. Lorem-ipsum = Lorem-Ipsum
    The full story is that there is a standing indesign file used over and over again which data-merges surnames which are in a massive database. The data arrives in uppercase and our mail barcoding software allows us to Title Case certain fields, but the Title Case behaviour has the following results:
    * McLeod = Mcleod
    * D'Agostino = D'agostino
    * Smith-Bunting = Smith-bunting
    i've been able to solve the McLeod = Mcleod problem with the following GREP style:
    (?<=Mc)\l
    and then apply a character style which is nothing more than All Caps.
    similarly, i've been able to solve the D'Agostino = D'agostino problem:
    (?<=\u')\l
    and once again apply the All Caps style to the affected letter. This also solves the O'leary problem to O'Leary.
    However, when I try these GREPs to grab the Smith-bunting style issues:
    (?<=\u\l+?-)\l     or   (?<=\u\l{2,}-)\l
    the search won't work, nor will it work with regular Find/Change GREP replace... yet the expression \u\l+?-\l will find the block that i'm after.
    I could use the search
    (?<=\l-)\l
    and this will find Smith-bunting = Smith-Bunting... but will also find co-operate = co-Operate (will find two words joined with a dash but  starts with a lower case letter).
    This is fine if the para style is applied to the  line in the address block containing the client's name, but if the name is referred to in a block of text, then that block of text has to have the para style with the GREP style applied, and any dashes between words in that para behave the same way as the name.
    yes, it is possible to go into excel and use the =PROPER(affected cell) and fix the Smith-Bunting fields, but i'm trying to create a solution which will work solely in InDesign so that other operators in the office (who aren't familiar with excel) can simply open the standing file and dump in the txt database generated by the mail barcoding software.
    there are other names that the mail barcoding's title-case fouls up i.e.
    * MacLeod = Macleod
    * van der Graaf = Van Der Graaf
    * van Diemen = Van Diemen
    but a GREP to make Macleod become MacLeod may foul up Mack, Mackie or Macy to become MacK, MacKie or MacY.
    I also know that a GREP for the van der or van won't work as the style will only force letters to become All Caps, not uppercase to lower...
    Ultimately...
    does anyone know a way to GREP style (not a find/change GREP) a fix for Xxxxx-xxxxx = Xxxxx-Xxxxx?
    Colly
    Colecandoo.

    I agree with Haakenlid on his Dirty-Workaround view -- I feel data should be entered the way it oguht to, not altered by some magic GREP styling -- but then again I can also sympathize with your POV re: a fire-and-forget solution even your dumbest operator can't miss.
    Oh the rigors of life.
    If you are totally, absolutely certain you want to do this by GREP, use this:
    (a) Set a To Capitals character style to the string
    \b\u\l+\-\l
    -- this will magically transform "Hon. Lt. Sir John Forsythe Blunt-object" into "BLUNT-Object".
    (b) Then override ( ! ) the first half again with another character style that removes the To Capitals attribute ( ! ):
    \b\u\l+-(?=\l)
    Notice how this expression is exactly the same as the above one, except for the very last code -- the next lowercase must also be caught, but now using a lookahead so its formatting won't be affected.
    This removes the All Caps override from the first halve, changing it from "BLUNT-Object" back to "Blunt-Object".
    Lots of side effects, I'm sure. Perhaps it is safer to teach your operators to run a single script.

Maybe you are looking for

  • Parsing a file name and printing a portion to an image

    Ive got a script writen for me that reads the file name of the image, creates a new layer , prints it ti the bottom of the image. I was wondering if anyone knew if there is a way to parse only a portion of the file name out and print that to the scre

  • Can we edit regionMap.xml

    Hi, w.r.t my previous post we need to add couple of new fields to existing page but create item is not enabled at the stackLayout. We are planning to make a copy of the page and create a custom version with same akRegionCode in the region map such th

  • FCPX won't recognize .fcpproject and .fcpevent files

    I'm trying to open a project shared with me on an external hard drive in Final Cut Pro X (version 10.1). It is in the proper folder structure (Final Cut Projects and Final Cut Events in the root of the drive.) The files CurrentVersion.fcpproject and

  • Kwqiclode: Error 3113 happened during loading of queue

    Hi, in ( alert_VIS.log ) of BDUMP file errors are captured as follows; =============================================== Tue Jan 29 07:49:51 2008 kwqiclode: Error 3113 happened during loading of queue Tue Jan 29 07:49:52 2008 kwqiclode: Error 3113 happ

  • PAL NTSC Switching of Component Output

    Hi, I just purchased a ATV in the US an brought it back to Europe where I am hocking it up to an older TV using the component otput. The cabeling is correct and I am not using a composite entry nore cable. The problem however is that the picture only