Connect failed: Connection timed out

[GastForen Programme Print/Bildbearbeitung Adobe InDesign GREP: Lookbehind UND Lookahead

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste
Print/Bildbearbeitung - Photos, Layout, Design
Themen
Beiträge
Moderatoren
Letzter Beitrag

GREP: Lookbehind UND Lookahead

Gerald Singelmann
  
Beiträge gesamt: 6269

7. Sep 2007, 11:43
Beitrag # 16 von 35
Beitrag ID: #311393
Bewertung:
(13854 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Zitat Hope this is of any use.


Are you kidding? Great info!
How do you know all that stuff, I wonder...

Thank you very much


als Antwort auf: [#311389]
X

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

7. Sep 2007, 11:55
Beitrag # 17 von 35
Beitrag ID: #311394
Bewertung:
(13846 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Zitat How do you know all that stuff, I wonder...


Read Friedl's book from cover to cover -- well, almost, anyway. And lots of practice. Then I wrote a ShortCut for O'Reilly on GREP in InDesign and was curious which aspects of other GREP implementations (Pearl etc.) would work in InDesign. It turns out that ID's GREP implementation is much richer than the interface would lead you to believe. (The ShortCut should be out any day now, I don't know what's keeping them.)

Regards,

Peter


als Antwort auf: [#311393]
(Dieser Beitrag wurde von Peter Kahrel am 7. Sep 2007, 11:57 geändert)

GREP: Lookbehind UND Lookahead

Gerald Singelmann
  
Beiträge gesamt: 6269

7. Sep 2007, 12:38
Beitrag # 18 von 35
Beitrag ID: #311410
Bewertung:
(13829 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Peter,

while you're here ;)

Did you find a way to set the upper-/lowercase of the replaced Text? Some grep implementations allow to replace e.g. by "\u..." to change to upper case. But I find no combination in InDesign that does not simply insert the characters.

Thank you


als Antwort auf: [#311394]

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

7. Sep 2007, 12:52
Beitrag # 19 von 35
Beitrag ID: #311413
Bewertung:
(13824 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
I don't think it's possible to change case using GREP in ID. A possible workaround is (if you use an OTF font) to set the Change Format Settings to All Caps.

Regards,

Peter


als Antwort auf: [#311410]

GREP: Lookbehind UND Lookahead

Marco Morgenthaler
Beiträge gesamt: 2474

8. Sep 2007, 14:29
Beitrag # 20 von 35
Beitrag ID: #311576
Bewertung:
(13791 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo

Zwei weitere Workarounds mit GREP habe ich bei http://indesignsecrets.com/...racter-lowercase.php gefunden: Weg über die Zwischenablage und Einfügen eines Unicode Value 0000.

Dabei ging es darum, Ausdrücke wie S123 in s123 zu ändern (also einen bestimmten Buchstaben gross- bzw. kleinzuschreiben).

Gruss Marco


als Antwort auf: [#311413]

GREP: Lookbehind UND Lookahead

Gerald Singelmann
  
Beiträge gesamt: 6269

8. Sep 2007, 14:48
Beitrag # 21 von 35
Beitrag ID: #311577
Bewertung:
(13775 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Marco,

danke für den Link, den hatte ich seinerzeit übersehen. Aber in dem Thread geht es darum ein S im Suchfeld gegen ein s auszutauschen.
Was interessant wäre, ist ein Weg (\w) gegen den entsprechenden Großbuchstaben auszutauschen. Andere grep-implementationen können das mit \u$1, aber InDesign leider nicht.


als Antwort auf: [#311576]

GREP: Lookbehind UND Lookahead

Marco Morgenthaler
Beiträge gesamt: 2474

8. Sep 2007, 15:11
Beitrag # 22 von 35
Beitrag ID: #311579
Bewertung:
(13767 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Gerald

Zitat A possible workaround is (if you use an OTF font) to set the Change Format Settings to All Caps.


Bei mir funktioniert das nicht nur bei OTF, sondern mit allen Schriften (Ersetzen mit der Formatoption Grossbuchstaben). Zumindest für den Wechsel Kleinbuchstabe --> Grossbuchstabe gibt es also eine einfache Lösung, oder sehe ich das falsch?

Gruss Marco


als Antwort auf: [#311577]

GREP: Lookbehind UND Lookahead

Gerald Singelmann
  
Beiträge gesamt: 6269

8. Sep 2007, 15:27
Beitrag # 23 von 35
Beitrag ID: #311582
Bewertung:
(13761 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Marco,

wenn der gesamte ersetzte String in Großbuchstaben gesetzt werden soll, dann würde das gut funktionieren.
Nimm aber mal das im englischen gebräuchliche Title Case, bei dem jedes Wort mit einem Großbuchstaben beginnen soll (was auch im Schriftmenü als Makro angeboten wird).

Da würde man nach
\b(\w)(\w*)\b
suchen und durch
\u$1$2
ersetzen wollen.

Alle Variationen über das Thema gehen in InDesign nicht.


als Antwort auf: [#311579]

GREP: Lookbehind UND Lookahead

Marco Morgenthaler
Beiträge gesamt: 2474

8. Sep 2007, 16:31
Beitrag # 24 von 35
Beitrag ID: #311587
Bewertung:
(13749 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Gero

\<\l
(Wortbeginn + Kleinbuchstabe)
Ersetzen durch Grossbuchstaben

würde zu diesem Title Case (Schriftmenü > Erster Buchstabe Im Wort Gross) führen.
Aber sicher gibt es Fälle, die nicht abgedeckt werden können.

Gruss Marco


als Antwort auf: [#311582]

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

8. Sep 2007, 21:44
Beitrag # 25 von 35
Beitrag ID: #311596
Bewertung:
(13701 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Marco,

Zitat Bei mir funktioniert das nicht nur bei OTF, sondern mit allen Schriften


I hadn't realised that it worked for all fonts -- all the better!

Zitat \<\l
Ersetzen durch Grossbuchstaben


Good idea. Your suggestion inspired me to try and find a title-caps feature that would at least marginally be less mindless than ID's title caps. ID simply (and mindlessly) capitalises the initial letter of every word, while in fact all kinds of function words need to remain in lower case (mainly conjunctions, articles, and preposions, such as and, the, a, of, on, in, to, for). This GREP does that:

\b\l(?!((nd|he|f|n|o|y|rom|or)\b)|\b)

The GREP, using negative lookahead (?!), is pretty convoluted (with the two separate \b switches at the end, but that's to ensure that single-letter words like 'a' remain in lower case). It also therefore doesn't touch I (capital i) but that would be in upper case anyway. In this sense this expression is Anglo-centric, but it can be adapted to other languages easily (see below).

This GREP ignores, in order, and, the, if/of, in/on, to, from, and for. It may overgeneralise a bit, but that could be rectified. I don't know how title caps work in German -- is every word included? If so, ID's standard feature is ok. If not, you simply list the words that should be excluded minus the first letter. For example, to ignore aus, den, der, des, and die, just use

\b\l(?!(us|en|er|es|ie)\b)

Regards,

Peter


als Antwort auf: [#311587]
(Dieser Beitrag wurde von Peter Kahrel am 8. Sep 2007, 21:45 geändert)

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

9. Sep 2007, 13:59
Beitrag # 26 von 35
Beitrag ID: #311629
Bewertung:
(13656 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
I've been playing around with this a bit more. This:

\b\l(?!((nd|he|f|n|o|y|rom|or)\b)|\b)

Can be made a bit simpler like this:

[-\s]\l(?!(f|he|nd?|o|y|rom|or)?\b)

to get rid of the second alternative. Furthermore, by using [-\s] instead of \b the Grep catches hyphenated words (second-rate, copy-edit) as well. To improve it even further, to ensure that any word following a colon (:) is changed to initial cap (e.g. in subtitles), the Grep can be changed like this:

:\s\l|[-\s]\l(?!(f|he|nd?|o|y|rom|or)?\b)

Regards,

Peter


als Antwort auf: [#311596]

GREP: Lookbehind UND Lookahead

Marco Morgenthaler
Beiträge gesamt: 2474

9. Sep 2007, 16:58
Beitrag # 27 von 35
Beitrag ID: #311637
Bewertung:
(13643 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hi Peter

Thank you for all these instructive examples. I think everyone who is not an expert in GREP (I am not) can learn a lot just by trying to understand why regular expressions like yours work.

Zitat I don't know how title caps work in German -- is every word included?


No, German has no specific rules for title caps. Nouns are capitalized, verbs not etc. (as in a normal text). In the sentence: Wenn hinter Fliegen Fliegen fliegen, fliegen Fliegen Fliegen nach, the caps depend on whether the word is a noun or not. (If flies are flying behind flies [= Positive Lookbehind =;o)], flies are following flies …)

Well, we are waiting for your introduction (Shortcut for O’Reilly).
Best regards
Marco


als Antwort auf: [#311596]

GREP: Lookbehind UND Lookahead

Thomas Richard
Beiträge gesamt: 19327

9. Sep 2007, 22:35
Beitrag # 28 von 35
Beitrag ID: #311665
Bewertung:
(13623 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Antwort auf [ Marco Morgenthaler ] Well, we are waiting for your introduction (Shortcut for O’Reilly).

It's a positive lookahaed, isn't it? ;-)


als Antwort auf: [#311637]

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

9. Sep 2007, 22:47
Beitrag # 29 von 35
Beitrag ID: #311668
Bewertung:
(13617 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
>It's a positive lookahaed, isn't it? ;-)

Hope so...

P.


als Antwort auf: [#311665]

GREP: Lookbehind UND Lookahead

Peter Kahrel
Beiträge gesamt: 182

9. Sep 2007, 22:51
Beitrag # 30 von 35
Beitrag ID: #311670
Bewertung:
(13615 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Marco,

>No, German has no specific rules for title caps.

So the notion 'title caps' has no significance in German, is that right? If the use of case in book titles in, say, bibliographies, and chapter titles, is no different than in any other text, what would you use title caps for in German?

Regards,

Peter


als Antwort auf: [#311637]
X