grep? Search & replace after 8 characters

Hi all

Sorry, I can't do something that I'm sure is quite simple.

Basically I have a linked file with a static caption that is name of linked file playback, the used color chart and the date of creation. It looks like this:

filename.AI:3

White, blue, Red

29/05/13

the name of the file is ALWAYS 8 characters and I would like to remove the portion of .ai:3 (what happens to) and keep the return transport.

with the color chart used, I only need the first color listed and uses grep , .*~b to remove everything after the comma at the end of the line, but it seems the same expression does not work using a. (period).

in the end, I expect to end up with this:

file name

White

29/05/13

Thanks for any help. I hope that makes sense!

s

I think that------... * $ will work. He finds all the first period in subsection from. If there is more than one period, and you do not want to remove the last and the following (as applicable), use \. [^.] *$

Tags: InDesign

Similar Questions

  • GREP search / replacement issue

    Hi all

    I'm new to GREP searches, but I had a lot of success in my current document (CS3). I'm running a problem now, however. I am trying to replace a manual coding with a paragraph style sheet and the paragraph (in this case italics) already applied character style leaves change when they are applied. For example in this sentence:

    "For what purpose, then, of conscience at all when it's in the main superfluous?

    changes made to the

    "For what purpose, then all conscience at all when he's in the main superfluowe?


    When I use my GREP search and replace. For the rest of this paragraph, the paragraph style is applied correctly, it is really strange to local formatting to be switching where it is applied.

    I searched the forums and haven't found anything on this issue, any ideas would be greatly appreciated.

    Thank you!

    I'm sorry to confirm your woes...

    It is a "bug" of sorts - you change the length of the text with your GREP, and ID forgotten somehow adjust formatting when text is deleted. I tried a few varieties because it usually works okay-ish, CS3, and CS4. With your sample, I couldn't remove even a single character without "moving" the formatting as well.

  • GREP search for all characters

    (Indesign CS6, Windows 7)

    For a book that I'm layout, the author marked text that should be indented like this:

    [indent]

    < paragraph >

    < paragraph >

    ...

    [indent]

    (Of course, in an ideal world, the Publisher would have charged the author simply use a word for this function.)

    I made a for the text indented paragraph style. I wanted to replace it in one shot, GREP search:

    (\[indent\]) ([.| \s|\r]+) (\[/indent\]) the middle part meaning one or more (+) of any character (.) or space or paragraph return. Replace it with:

    $2 and the paragraph style (getting rid of the markers at the same time).

    Nothing has been found. I changed it to (\[indent\])([\w|\s|\r]+) (without the end marker [indent], to see what would happen) and now he found something - but stop at the first mark of punctuation (only reaching no not the end marker). So I tried to fill in punctuation: (\[indent\)] ([\w|\.|-, |: | \s|\r]+]) and each time more was found (by the way,------. here means a complete stop). If it works more or less.

    The problem is, is a technical manual and most equations etc are in the text that should be indented, so there are a lot of characters who are neither letter or number. And of course you can not call it a clean solution.

    It's the kind of string search and replace I would also use on many other projects. Does anyone know a better solution? Now, 'any character' doesn't seem to work, there at - it a code for "any character being not not a letter or number? Thanks in advance.

    Try (? s)(\[indent\]\r?) (.+?) (\[/indent\]\r?)

    The (? s) runs on single line mode so it can be found through several paragraphs and the (. +?) is the shortes match between the tags. I've included returns after the tags, if there has, based on your example that the tags are separate paragraphs. If they are at the end of the paragraph that you want to keep, remove the \r? to avoid losing the paragraph breaks.

  • GREP: Search and replace

    Does anyone know if its possible to take a list (shown on the lower part of the image) and run a GREP search and replace to create the list of tabs (shown on the picture)?

    I know that the majority of it can be made with the regular search and replace: separate the first and last name; MD and MD #; Postal code and telephone number.

    What I was not able to understand is how to add a tab forward and backward the state abbreviations 2-digit, the Middle Initial, phone number and more important even if there is a way to add tabs in when there aren't the same amount of lines, such as the field of specialty.

    I know that I can use the GREP search and replace to add a tab before each paragraph back, then remove the tab where there are 2 paragraph after each game returns, then substituting a tab and a paragraph back to just a tab, together running all the rows in each set.

    Any help would be greatly appreciated, and if there is anywhere I can learn more about GREP, I would love to learn it.

    Thank you

    Peter

    Doctors List Styles.png

    Peter, try this...

    Find:------.<>

    Replace: \t$0

  • Help with GREP search and replace

    I've never used grep before and I'm stumped.  I have a document that lists the times for different classes.  Times are variously listed as 9-10, 9-10, 9-10 or 9-10, to get examples.  The problem is that there may be no space or a space on the left or the right of the hyphen.  I want it all the time as 10:30 - 11:30, for example.  In other words, the link must have a space on each side of it.  I think that this could be accomplished with GREP search and replace, but I don't understand the syntax well enough to make it work.

    Can someone tell me how to write the search and replace expressions?  (Of course the real time could be any hours).

    Thank you!

    It is tempting to add spaces of * all numbers separated by a dash. If you don't know all time have some minutes, then it is safer to use this:

    (?<=:\d\d)>

    .. Replace with space hyphen space.

    He seeks the "settler, any digit, any digit" (which is * found * not * included *), followed by 'optional of a space, a hyphen, optional space' and must be followed by 'any number' (again, not counting this one). Since the figures before and after are * found * not * included *-which is due to the (? xxx) syntax - all that needs to be replaced is the dashboard itself. Making the space before and after the optional dashboard (using a single "?" immediately after each), no matter if it * is * a space or not, all the combinations will be found and replaced.

  • GREP find/replace + paragraph Styles

    Hello

    I'm editing a long document and have benefited from the assistance of the community already, but being new GREP Style, find/replace, I need to ask for additional help.

    Below a screenshot of the script (original). Two blocks of text you see anticipated by the icons have have styles of different paragraphs. Icons are placed like custom glyphs.

    Now, the last line with C2, 9, 14,... is the target of this post. They are buses of London and I created a paragraph with another icon. The copy that I work with unfortunately is as you see. Buses will follow «;»

    Resulting to place a \r after the semicolon and assign the new paragraph style. The item to work with is (probably) the last "," before the registration of the bus. All entries have it in the same way, where a search/replace global grep should work fine.

    My attempts:

    I used of a previous debate (? < =------;)) [^ ;] + $ to match everything from the end until the last semicolon, but then I found the problem preserving the matched characters and placing \r (using the (? < =-;). start at the beginning and stops at each point comma + space)

    So question: how to stop at the first semicolon at the end and replace the space with \r to create a new paragraph?

    Then, it is two question :-)

    From my previous attempts, I noticed that when you replace the semicolon + space with \r, and change the style of paragraph at a time (from Rail to Bus) caused the Rail paragraph style change (logic) to the style of Bus. So I tried to say the paragraph style of the track "Following paragraph Style is style of Bus" (and not to change the paragraph style in find/replace), but in a way that no longer works.

    Second question is: given to split the find/replace in two steps, how then transform / apply to newly created paragraph the correct style of Bus?

    Thank you in advance for your valuable assistance. So far, the community has been great!

    Antonio

    Original

    Screen Shot 2016-07-12 at 22.32.23.png

    Result for

    Screen Shot 2016-07-12 at 22.54.51.png

    Hi Antonio,.

    If I understand correctly, in 2 regex [1 click play with Multi/find-replace our friend Martinho da Gloria]:

  • Grep search only on the current page, return array "search everything".

    Hello

    Is there a way to grep search only the current page, or any page chosen in my paper (myDocument.pages [i])?

    I can only manage to search for in the document.

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "Chapter (\d+)";

    myDocument.findGrep)

    Also, is there a way to return the content to find? In this case, I want the $1 this research...

    var a = myDocument.findGrep (). ?

    Thank you

    Christopher

    the error is because you have not initialized the tabular myRet variable.

    Another problem is the use of textframes.everyItem (), because that returns a different object.

    and another is what happens if a textframe is empty you will get an error on the meaning of "object has no text for find/replace.

    Here is the fixed code:

    var myRet=[]
    var myDocument=app.activeDocument;
    var tf = myDocument.pages[0].textFrames.everyItem().getElements(),
    tf1 = myDocument.pages[0].textFrames.count();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "Chapter";
    for (var i = 0; i < tf1; i++){
     if (tf[i].characters.length){
    myRet=myRet.concat(tf[i].findGrep());
    }
    }
    alert(myRet)
    
  • Problem with GREP search

    I have a GREP search that finds characters in importing XML < i > and < /I > that surround it make italic text:

    Search text with ^ I ^ and ^ / I ^ around it. ITALIC

    app.findGrepPreferences.findWhat = "(\\^I\\^)(.+)(\\^/I\\^)";

    app.changeGrepPreferences.changeTo = "$2";

    app.changeGrepPreferences.appliedCharacterStyle = "italic";

    app.activeDocument.changeGrep ();

    The problem is that if there is two blocks of text in the para with the codes around him, he finds the first < i > and < /I > last code and put the text in italics .

    Thus, for example, "the quick brown fox < /I > < I > leaps over the < I > < /I > lazy dog as example text"

    as ' the quick brown fox < /I > jumps above the < I > lazy dog as example text ",.

    and not "the Quick Brown Fox jumps over the lazy dog as an example of text".

    I hope this has a simple fix, but disappointing because I thought I had nailed!

    Thanks in advance for any help (as always).

    Simon.

    Well, as the saying always Jongware, GREP is greedy and always want to pick up as much as the expression allows.

    Simply add the question mark after the sign more, and you get the result you expect.

    app.findGrepPreferences.findWhat = "(\\^I\\^)(.+?)(\\^/I\\^)";
    

    Hope that helps.

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • Need help with the GREP search delete numbers

    Hello everyone,


    I have the text with the following reference numbers, I need to remove the numbers before each start of paragraph, but some figures following the space, some of the figures are without space. Please help me remove these figures with GREP or MS Word search or other means

    Before:

    1 Apple

    2Ant

    4 animals

    55 flowers

    56Doctor

    466 painters

    467Teacher

    After:

    Apple

    Ant

    Animals

    Flowers

    Doctor

    Painters

    Teacher

    Thank you
    Siva

    Try this GREP and replace it with nothing:

    {^ \s{0,}\d+\s{0,}

  • Application updates in bold and in italics while doing a search/replace on the contents of merged data

    Hello
    Wonder kind knowledgeable people if you can help me with a question find/replace.

    I'm doing a fusion of data of book content in indesign, where my data merge file is a simple text csv file that is delimited by tabs. I have two things (almost like here) I would like to make to specific parts of the text, but do not know how to achieve this.

    -First of all, I would like to preserve the words/phrases of form 'italic', but it's obviously lost in a csv file.  Is there anyway that I can mark these words so a search/replace can make this italic of the word.  Im hoping that there is a solution that looks something like this;
    for example.  Content of the book is 'the italics of the word needs to be adjusted.
    Original content is modified to be "the word $Italic $ $ needs to be adjusted", so that a dollar sign encapsulates the word in italics.
    Then I am able to merge data from the csv file and somehow make a search/replace words/phrases that are wrapped by the dollar sign.  So, do a find/replace all the words/phrases that satisfy this condition and then apply italic to all the words between the dollar signs.

    -My other question is that I use the ' |' character in my text to determine paragraph separators.  I then do a find/replace after you import the text to replace all occurrences of ' |' for the paragraph separator (a kind of symbol $, a representative character in the menu drop down to the right of the change to). It works fine, but I would like to make a "BOLD" format paragraph separator so that it can better distinguish the separation of text sections.

    But this is different from my problem "italic" above, since I am trying to apply a "BOLD" format to the character "change to", rather than something that exists in my original csv.

    Hope I think, but I'd be happy to provide you with screenshots etc. (when I get home at )
    Best Rgds
    L

    two solutions.

    for the solution of italics, I would say that the OP has answered his own question with one exception - do not use the symbols dollar, instead use = or another character that is not reserved by GREP.

    the solution I would use for italics would be a GREP search once the merger completed. Take a look at the picture to see what I did.

    the second solution: styles GREP.

    This means that the text will have a paragraph style are entrusted to him. make a style and character called "BOLD" in this style, the only thing to change is located in basic character formats, set the bold font style. might even make the character another example cyan color is more easily strucure.

    Then go to the paragraph style options, click on GREP styles and correspond to the following screengrab

    the advantage with a GREP style is that once the vertical bar (|) is replaced, the GREP style bold is lost; and that means less post processing and not needing a second search of the text - it's all living.

  • With the help of markers of reference in a GREP search

    In a document of 300 pages, with hundreds of notes, I want to insert thin spaces between single endquotes and reference markers. The easiest way seemed a GREP search and repace. I search (\')(~F) and replace it with $1 ~ <$ 2. The result is ' ' (endquote-thin space-endquote). When I try to replace the AB to A-thin space-B in the same way, the result is good. So what goes wrong? ([I also tried ~] for the endquote.)

    (By the way, I have a workaround, but I want to understand how GREP search work.)

    Notes are not really part of the semi-official GREP definition, and I imagine that Adobe programmers had to fix some workarounds to make it work at all. They are not characters simply unique (quotes, spaces and possibly text are variable) but 'contains' a lot more information, as do the anchored objects. This could be the reason why they are not fun to play with GREP regular operations.

    In this particular case, you can bypass searcing for the marker reference code and replace. Search

    (\') (?=~F)

    and replace with

    $1 ~.

    The combo (? = ~ F) will be of find, but do not include the reference code and so much work around the problem.

  • Replace global invisible characters.

    How can you do a global replace of two returns of paragraph for one and a global replacement of a period followed by two spaces to a period followed by a space. It is easy in Word, but I can't find how to present these invisible characters in the window replaced.

    Since you don't mention the specific version of the Pages you use, I'll take an example of using v5.6.2 Pages.

    Replace the two paragraph returns with one:

    1. View menu: show details
    2. Enter two paragraph returns
      1. Select both and press command-e to make these the search to find parameter
      2. Choose an answer and the Edit menu: find: use selection to replace
      3. Delete 'model' paragraph two returns that you entered to build a and b above.
    3. Press control + f to search.
      1. You may need to click on the gear icon to choose to search / replace.
      2. All successive double paragraph marks will give you an amount found
      3. Replace everything.

    Replace a point followed by a double with a period and a single space:

    1. Enter a period dragged by two spaces.
      1. Select all three characters and press command-e to make the search to find parameter.
      2. Select the period, and a space to the right and then menu Edition: find: use selection to replace
      3. Delete the period and two spaces that you used to complete a and b here.
    2. Press control + f to search
      1. If you have an amount found, then click on replace all.

    In Pages ' 09, the part of command-e works the same to make a selection of the target to find, but there is no Edit menu: find: selection of use to replace them. Instead, select the characters you want to use for the replacement and then drag and drop in field to replace the search dialog box.

  • How rename (search/replace) par UN script styles sheets

    How rename (search/replace) the sheets of styles, par UN script?

    In order to remove all the "exotic" characters

    I think you chose the wrong forum. This forum, EST pour Acrobat JavaScript only.

  • How can I make a long list of search - replace only the master

    Hello world

    I had this script:

    //---------------------------------------------------------------------------------------- -------------------------------

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text on master blocks spreads are not affected.
    If you want to unblock, please add something like this:

    Unlock all elements of each document page on is spreading and Captain spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "\\b20\\d+\\b";

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = String (Number(flattenedFoundArray[n].contents) + 1);
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;

    //---------------------------------------------------------------------------------------- -------------------------------

    made by Uwe

    I change in this, to make a multi elements of search - replace only the master

    //==============================================================================

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text spreads masters frameworks are not affected.
    If you want to unblock, please add something like this:

    Unlock all items page of each document of spreads and master spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "USA";

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = "CHINA";
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;


    //---------------------------------------------------------------------------------------- -------------------------------

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text spreads masters frameworks are not affected.
    If you want to unblock, please add something like this:

    Unlock all items page of each document of spreads and master spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = 'Washington DC';

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = "Beijing."
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;


    //===============================================================================

    only what I can do is to repeat and repeat again

    is this another perfect solution to do?

    Thank you

    Teetan

    Try this,

    findChange("USA", "CHINA");
    findChange("Washington DC", "Beijing");
    
    function findChange (findWhat, changeContent){
        var myDocuments = app.documents.everyItem();
        var myLayers = myDocuments.layers.everyItem();
        //Locked text frames on master spreads are not touched.
        //If you want to unlock them you have to add something like this:
        //Unlock ALL page items in every document on spreads and master spreads (optional):
        myDocuments.pageItems.everyItem().locked = false;
        var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
        //Unlock the layers (optional)
        myLayers.locked = false;
        //Lock all first level page items on normal spreads
        //That leaves the page items on master spreads unlocked:
        myPageItemsOnNormalSpreads.locked = true;
        //Now for the GREP part:
        app.findChangeGrepOptions.includeMasterPages = true;
        app.findGrepPreferences = changeGrepPreferences = null;
        if(findWhat)app.findGrepPreferences.findWhat = findWhat;
        //Do the search on "all open document" level
        //That will return an array of arrays:
        var myTarget = myDocuments.findGrep();
        //Flattening the myTarget array:
        var flattenedFoundArray = [];
        for(var n=0;n=0;n--){
            if(changeContent)flattenedFoundArray[n].contents = changeContent;
            };
        //Unlock all objects on normal spreads:
        myPageItemsOnNormalSpreads.locked = false;
        //Reset GREP find and change prefs:
        app.findGrepPreferences = changeGrepPreferences = null;
    }
    

    Vandy

  • Grep search / text search + spent research

    Is it a way to erase the previous GREP search / text (search/replace) searches for 'search' and ' change in "boxes? Is - this specific document or a matter of preference ID?

    Find-Change.png

    These lists are stored in the file InDesign SavedData (part of the prefs.). You can remove them by closing the ID and by renaming or deleting the file to your user library (it's a file hidden, by the way). You will also lose your list open the recent item when you do this, but probably nothing else you won't miss.

    See replace your preferences for the location of the file.

Maybe you are looking for

  • Music not purchased from I-Tunes.

    I recently got my first I-Phone 6.  I had some music on my old phone (Blackberry) and my laptop (Dell) that I bought the site of artists.  Is there anyway to put this music on my new phone?  Or I have to buy brand-new via I-tunes?  Thank you!!!

  • VIZIO Smart TV with built-in Skype App receives "orange badges", but other Skype applications show nothing...

    Hello First off I apologize for opening a new thread if this has been discussed before... As I am a noobie on this interesting platform... lol Now I just installed Windows for the desktop app and have Windows 8 MS (appstore) and also have Windows Pho

  • My volume control is missing from the taskbar.

    Even if I had the volume control on the taskbar before, I get the message under sound & audio in the control panel volume control has not been installed and that I should go to add/remove program to install. How do I do that?

  • Vista themes

    Hello, I recently changed my theme for windows vista, the classic view in an attempt to improve performance, how ever when I went to restore the vista theme has disappeared, it would be possible to either have the file theme sent to me or a web addre

  • I think that my graphics card is the original BSOD - sort sure?

    I've been struggling with BSOD for a month now and have reinstalled Vista 3 times. I always get the BSOD with a 116 error code indicating the nvlddmkm.sys. I can start safe mode and I can boot Vista with the graphics driver disabled nVidia. When I ha