To learn more about GREP, visit: Jat 6:16 pm $1 (and apply paragraph style that includes auto numbers) Reverse first and last name (but watch out for middle names or initials, too)Īfter reversing the names (see above), fix any last names that started with Van or De.įind and remove duplicate paragraphs/lines in a listįind lists in which people have actually typed a number followed by a period followed by a space, and apply automatic numbered list style. Note that the dollar and dot have to be ‘escaped’ because they normally mean something different.įind anything inside parentheses (again, parens need to be escaped)Įscape everything that is, find (a b*c) exactly, without having to worry about escaping each special character.Īdd an anchored object at the beginning of each paragraph (cut object to clipboard first) This uses ‘Positive Lookbehind’ and ‘Positive Lookahead’įind a dollar sign followed by one digit, a period, and two digits. ![]() Unfortunately, it fails on 355/113 (which happens to be a reasonably good approximation of ?, proving that nothing is perfect).įind any kind of a, no matter the accent, including a, á, à, ä, etc.įind st, rd, or th ordinals (such as 1st, 2nd, 3rd) that follow a digit?in order to apply superscript to just the ordinal (not the digit).įind any text inside parentheses, but not including the parentheses. Robust fraction grep: Will find fractions, but leave out dates such as 6/98, 9/11, or. or )įind any four digits (the curly brace expression is not found in the InDesign menu) Milk Chocolate, milk chocolate, milk Chocolate, Milk chocolateĬolor or colour (the ? means the previous character or expression may or may not be there)Īny string of letters that starts with c and ends with e, such as chocolate, Chocolate, case, coarse, etc.Īny whole word that begins with c and ends with eĮxactly the same as above, but using \b for ‘word boundary’ Always look for that flyout menu! Expressing Or (Milk|Dark) Chocolate ![]() Let’s focus the comments below on solutions, rather than questions.Īnd remember: you don’t need to memorize all these codes. Note: Please don’t use the comments below to ask “what’s the grep code for…”? Instead, use our forums to ask those kinds of questions. Or, if I think of new ones, I’ll just update this table from time to time. If it’s really helpful, I may steal it and add it to the table in this blog post. Then, if you have a grep code you want to share with others, feel free to add it to the comments below. You may need to tweak it a little, or combine some of these to achieve your task. ![]() But you don’t always have to figure out all the grep codes yourself! Use the table below to find a grep expression that is close to what you’re looking for. It shows up in several places in InDesign, notably the Find/Change dialog box and the GREP Styles feature. (?#find) (?P\b. ), (?P\b.GREP is an incredibly powerful technology for finding and replacing text. Groups can be named (assume a file of lastname, firstname altered using "preg_replace()") disallow digit AND whitespace occurrences - ? * rest of phone number means not digit OR whitespace, both match \s whitespace (space, tab, vtab, newline) \W, \D, or \S, (NOT word, digit, or whitespace) ) shorthand classes \w "word" character (letter, digit, or underscore) \d digit gr y match gray or grey match any letter or digit (In always escape. Use \ to search for these special characters:Ĭ: \\windows matches c:\windows alternatives - | (OR) cat|dog match cat or dog order matters if short alternative is part of longer id|identity matches id or identityĪs soon as 1st alternative matches identity|id matches id or identity order longer to shorter when alternatives overlap (To match whole words, see scope and groups.) character classes - or match any vowel match a NON vowel r ng match ring, w rangle, sp rung, etc. ![]() REGEX Cheat Sheet GREP cheat sheet characters - what to seek ring matches ring, sp ringboard, ringtone, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |