fde101 Posted November 28, 2018 Share Posted November 28, 2018 I'd rather have PCRE than GREP. PCRE is a much richer language. Quote Link to comment Share on other sites More sharing options...
MikeW Posted November 28, 2018 Share Posted November 28, 2018 18 minutes ago, fde101 said: I'd rather have PCRE than GREP. PCRE is a much richer language. The request was for GREP as used in InDesign, which I believe uses PCRE (including in its JavaScript). Much more extended than the various flavors of ECMA, which lags far behind in capabilities. The main plus side to me for PCMA is there are a bazillion tutorials on the web and it's used everywhere and in most text editors and dedicated PCRE tools. Quote Link to comment Share on other sites More sharing options...
v_kyr Posted November 30, 2018 Share Posted November 30, 2018 Nowadays usually Perl Compatible Regular Expressions (PCRE) are more or less the defacto used standard here (at least among programming languages, better dev tools and editors), which then also offer look-around assertions. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
Peter Kahrel Posted November 30, 2018 Share Posted November 30, 2018 On 11/28/2018 at 5:05 PM, MikeW said: The request was for GREP as used in InDesign, which I believe uses PCRE (including in its JavaScript). InDesign uses the Boost libraries for its GREP. Those are probably Perl-compatible -- InDesign's GREP is very powerful. InDesign's JavaScript (ExtendScript), however, uses standard JS regular expressions, much less powerful than InDesign's (e.g. no lookbehind, no Unicode properties). Peter Quote Link to comment Share on other sites More sharing options...
MikeW Posted November 30, 2018 Share Posted November 30, 2018 7 hours ago, Peter Kahrel said: InDesign uses the Boost libraries for its GREP. Those are probably Perl-compatible -- InDesign's GREP is very powerful. InDesign's JavaScript (ExtendScript), however, uses standard JS regular expressions, much less powerful than InDesign's (e.g. no lookbehind, no Unicode properties). Peter Many thanks for the clarification, Peter. Mike Quote Link to comment Share on other sites More sharing options...
fde101 Posted November 30, 2018 Share Posted November 30, 2018 This is a rather interesting source of confusion. "grep" is a UNIX command that scans through files using regular expressions. Those regular expressions are much less capable than the PCRE ones. Referring to these patterns as being "GREP" patterns suggests the use of the less capable patterns used by that command. They are poorly named. Quote Link to comment Share on other sites More sharing options...
JGD Posted December 1, 2018 Share Posted December 1, 2018 Count me among those who also think this is a must-have in a pro-level application. GREP styles saved my proverbial derrière in more than one InDesign project already… Quote Link to comment Share on other sites More sharing options...
evtonic3 Posted December 8, 2018 Share Posted December 8, 2018 GREP has helped me out so much in editing a corporate manual, especially changing out swatches. Please add GREP to Publisher! Quote Link to comment Share on other sites More sharing options...
Headway Posted December 9, 2018 Share Posted December 9, 2018 Please add GREP and GREP styles. Quote Link to comment Share on other sites More sharing options...
OpalGraf Posted December 12, 2018 Share Posted December 12, 2018 RE find and replace and RE styles are so important that they were my first thought when I got to know that Affinity is going to make Publisher. Of course richer the flavour is more powerful it gets. But it is a must have for me. So please add any. Quote Link to comment Share on other sites More sharing options...
v_kyr Posted December 14, 2018 Share Posted December 14, 2018 On 11/30/2018 at 2:35 PM, fde101 said: This is a rather interesting source of confusion. "grep" is a UNIX command that scans through files using regular expressions. Well "grep" is a program not a shell command or the like here, it's initially developed by Ken Thompson for AT&T UNIX. The term "grep" stands for... global/regular expression/print [g/re/p] (see the Gnu grep manual, 4 Usage -> QA point 16. for reference ) or global search for a regular expression and print out matched lines ...and stems from the old Unix ed line based texteditor (similar to ex and edlin). Regular expressions have been and are widely used and are very popular on Unix systems and their derivates. I recall that when I learned C programming and working with Unix systems, one very nice book in the past times was "UNIX-Toolbox: Programming with UNIX" (from Brian W. Kernighan and Rob Pike) which was full of infos and usage references to most regular expression capable programs like awk, ed, emacs, grep, sed, vi/ex, etc. However, over the years things have changed, been reworked and enhanced in the Unix world, new more powerful things like Perl discovered the scene and established then new standards in this regard. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
fde101 Posted December 14, 2018 Share Posted December 14, 2018 7 hours ago, v_kyr said: Regular expressions have been and are widely used and are very popular on Unix systems and their derivates. Yes, and rightly so. Really, the fact that this is named "grep" search / styles is a rather odd choice, because it has nothing to do with grep. They are really "regular expression" search / styles, and even on UNIX platforms there are quite a few text editors and other programs that support "regular expression" search capabilities. "grep" is just one tool on UNIX that happens to use regular expressions, and based on the above commentary it seems InDesign even uses more perl-like regular expressions (a superset of what grep can do) so naming the feature based on a tool that happens to use a smaller subset of regular expression functionality than "grep" uses is kind of strange. Quote Link to comment Share on other sites More sharing options...
thomaso Posted December 14, 2018 Share Posted December 14, 2018 30 minutes ago, fde101 said: Really, the fact that this is named "grep" search / styles is a rather odd choice, because it has nothing to do with grep. They are really "regular expression" search / styles (...) Since GREP means "Global Regular Expression Print", it appears logical to name this missing feature "grep search". On 11/30/2018 at 6:39 AM, Peter Kahrel said: InDesign uses the Boost libraries for its GREP. Those are probably Perl-compatible -- InDesign's GREP is very powerful. InDesign's JavaScript (ExtendScript), however, uses standard JS regular expressions, much less powerful than InDesign's (e.g. no lookbehind, no Unicode properties). Peter It may be a coincidence, but not necessarily, that a newbie named Peter Kahrel has an eye on this topic. https://www.oreilly.com/library/view/automating-indesign-with/0596529376/ Quote macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1 Link to comment Share on other sites More sharing options...
fde101 Posted December 14, 2018 Share Posted December 14, 2018 On 11/30/2018 at 12:39 AM, Peter Kahrel said: Those are probably Perl-compatible They claim to be by default: https://www.boost.org/doc/libs/1_65_1/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html Quote Link to comment Share on other sites More sharing options...
v_kyr Posted December 14, 2018 Share Posted December 14, 2018 On 12/14/2018 at 1:17 PM, fde101 said: Really, the fact that this is named "grep" search / styles is a rather odd choice, because it has nothing to do with grep. They are really "regular expression" search / styles, and even on UNIX platforms there are quite a few text editors and other programs that support "regular expression" search capabilities. "grep" is just one tool on UNIX that happens to use regular expressions, and based on the above commentary it seems InDesign even uses more perl-like regular expressions (a superset of what grep can do) so naming the feature based on a tool that happens to use a smaller subset of regular expression functionality than "grep" uses is kind of strange. Well the thread title is missing at least the "grep like find/replace..." here, since yes, grep is just one of those older tools which offers a text based regular expressions matcher (see the article from Brian Kernighan in the "Beautiful Code book". Quote ... Stephen Kleene invented regular expressions in the mid-1950s as a notation for finite automata; in fact, they are equivalent to finite automata in what they represent. They first appeared in a program setting in Ken Thompson’s version of the QED text editor in the mid-1960s. In 1967, Thompson applied for a patent on a mechanism for rapid text matching based on regular expressions. The patent was granted in 1971, one of the very first software patents [U.S. Patent 3,568,156, Text Matching Algorithm, March 2, 1971]. Regular expressions moved from QED to the Unix editor ed, and then to the quintessential Unix tool grep, which Thompson created by performing radical surgery on ed. These widely used programs helped regular expressions become familiar throughout the early Unix community. Thompson’s original matcher was very fast because it combined two independent ideas. One was to generate machine instructions on the fly during matching so that it ran at machine speed rather than by interpretation. The other was to carry forward all possible matches at each stage, so it did not have to backtrack to look for alternative potential matches. In later text editors that Thompson wrote, such as ed, the matching code used a simpler algorithm that backtracked when necessary. In theory, this is slower, but the patterns found in practice rarely involved backtracking, so the ed and grep algorithm and code were good enough for most purposes. Subsequent regular expression matchers like egrep and fgrep added richer classes of regular expressions, and focused on fast execution no matter what the pattern. Ever-fancier regular expressions became popular and were included not only in C-based libraries, but also as part of the syntax of scripting languages such as Awk and Perl. ... So a thread title like "find/replace feature which supports regular expressions" would probably have been better here, but on the other side most people still know what is meant here with grep as a synonym. - In this sense ... Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
Zaglbauer Posted December 26, 2018 Share Posted December 26, 2018 Yes, please! GREP in find&replace and in paragraphs styles. Essential to me for automatically raise 2s and 3s for units of measurements, English ordinal numbers or the female endings of academic titles in german texts. Quote Link to comment Share on other sites More sharing options...
rm3m Posted December 29, 2018 Share Posted December 29, 2018 One more vote for GREP. I have used it in two long InDesign documents, and it just saves tons of work. I would add that being able to group several GREP commands together would be incredibly useful. But I'd be more than happy with individual GREP commands. Quote Link to comment Share on other sites More sharing options...
garrettm30 Posted January 2, 2019 Author Share Posted January 2, 2019 The discussion of what to call this has been interesting to me (I’m just now catching up on the thread). I am familiar with regular expression from my experience in programming (predominantly PHP, which does use PCRE). In the last few years, I have come into the publishing world, where I noticed InDesign calls searches by regular expressions “GREP” in its Find-Replace dialog. I have known there is technically a difference, but I have not really paid attention to what it is. When naming this thread, I supposed there were many more readers familiar with InDesign than with programming, so I named the thread according to what I supposed people are familiar with. If Affinity chooses to add this feature and call it “Regular Expressions,” then perhaps that is the best and most consistent, but honestly, I’ll be glad to have it even if they choose to call it “GREP” even if slightly inaccurate, or even “Geeky Super Search.” As to flavor, sure, I would be happy with PCRE, as that is what I know. I have occasionally come across features that work in regular expressions in PHP that didn’t work in InDesign GREP—I can’t remember what it was, maybe negative lookbehind, or some such. However, I suppose that we most likely would get whichever flavor is built into the programming architecture in which the apps are written. I only know web programming, so I am guessing here, but I would think that if they use the functions provided by the programming languages they are using, then it should be a very easy thing to implement. And just for fun, here is the resource I use for building my regular expressions, both for use in InDesign and also for programming. Perhaps some of you may find it as useful as I have: https://regex101.com Quote Link to comment Share on other sites More sharing options...
Clanks Posted January 2, 2019 Share Posted January 2, 2019 Uhm, what does GREP stand for? Quote Link to comment Share on other sites More sharing options...
garrettm30 Posted January 2, 2019 Author Share Posted January 2, 2019 5 minutes ago, Clanks said: Uhm, what does GREP stand for? On 12/13/2018 at 10:48 PM, v_kyr said: The term "grep" stands for... global/regular expression/print [g/re/p] (see the Gnu grep manual, 4 Usage -> QA point 16. for reference ) or global search for a regular expression and print out matched lines Quote Link to comment Share on other sites More sharing options...
fde101 Posted January 3, 2019 Share Posted January 3, 2019 Yep, the types of patterns we are discussing are regular expressions. The "grep" utility is one traditional UNIX command that happens to use regular expressions, as do many other tools and programs. Quote Link to comment Share on other sites More sharing options...
Mateusz Czekała Posted January 28, 2019 Share Posted January 28, 2019 I can't imagine publishing a book without using GREP. I can confirm that this feature is a necessity when you're working with Polish texts. Quote Link to comment Share on other sites More sharing options...
fde101 Posted January 28, 2019 Share Posted January 28, 2019 3 hours ago, Mateusz Czekała said: I can't imagine publishing a book without using GREP. Mateusz Czekała 1 Quote Link to comment Share on other sites More sharing options...
Staff Patrick Connor Posted February 22, 2019 Staff Share Posted February 22, 2019 People who have contributed to this thread may be interested in our first beta release (#249) to include Regular expressions in find and replace, and help us test this improvement to the feature. Quote Regular Expressions for Find and Replace We have added the facility to Find and Replace using perl type (or ‘ECMAScript with perl extensions’) regular expressions The options to turn the feature on are found on the Find and Replace panel search options drop menu 'Regular Expression' - Find / Replace will be performed using the "C" or "POSIX" locale 'Locale Aware Regular Expression' - Find / Replace will be performed using the locale inferred from the text being searched and locale aware collation is implied Please note that a 'Locale Aware Regular Expression' has to treat each block of text with a different language setting in isolation Affinity Publisher 1.7.0.249 for Mac Affinity Publisher 1.7.0.249 for Windows garrettm30 and fde101 1 1 Quote Patrick Connor Serif Europe Ltd Latest V2 releases on each platform Help make our apps better by joining our beta program! "There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self." W. L. Sheldon Link to comment Share on other sites More sharing options...
Peter Kahrel Posted February 23, 2019 Share Posted February 23, 2019 Great, thank you. It's incomplete (e.g. no lookahead and lookbehind yet) and still a bit buggy (bug reports submitted), but it's early days and I look forward to a full implementation. P. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.