Skip to main content
added 131 characters in body
Source Link

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks!

(NoteUPDATE: I also tried enclosinggot it to work! All I did was switch ordering of the whole expression in (), as I've frequently seenexpressions around the | operator presented like this (a|b). However, the expression :

(^[^:]*:|(?<=\. )[^:]*:)|^[^:]*: has

So my problem is fixed, but I'm leaving the same issue.question up because the developer in me wants to know what is going on here - some kind of evaluation order unique to InDesign's regex engine, or something else?

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks!

(Note: I also tried enclosing the whole expression in (), as I've frequently seen the | operator presented like this (a|b). However, the expression (^[^:]*:|(?<=\. )[^:]*:) has the same issue.

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks!

UPDATE: I got it to work! All I did was switch ordering of the expressions around the |:

(?<=\. )[^:]*:|^[^:]*:

So my problem is fixed, but I'm leaving the question up because the developer in me wants to know what is going on here - some kind of evaluation order unique to InDesign's regex engine, or something else?

added 212 characters in body
Source Link

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks!

(Note: I also tried enclosing the whole expression in (), as I've frequently seen the | operator presented like this (a|b). However, the expression (^[^:]*:|(?<=\. )[^:]*:) has the same issue.

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks.

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks!

(Note: I also tried enclosing the whole expression in (), as I've frequently seen the | operator presented like this (a|b). However, the expression (^[^:]*:|(?<=\. )[^:]*:) has the same issue.

Source Link

InDesign: Regex/GREP works on tester, not in InDesign - issue with OR/| operator?

I have the following sample text:

Writing: Gnusto. Editing: Caskly. Circulation: Izyuk.

I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "Editing:", "Production:"). The following works on this online regex tester:

^[^:]*:|(?<=\. )[^:]*:

However, when I try it on InDesign Find/Change..., it only selects "Writing:".

The issue seems to be with the interpretation of the OR (|) operator. The expression to the left of the | will successfully select "Writing:". The expression to the right will successfully select "Editing:" and "Art:" - in fact, if I remove the left expression and the |, InDesign will indeed select them.

The | means either/or in standard regex languages, which means both expressions on either side will be tested for a match. However, here, it's as if InDesign can't interpret the | and just stops at it. Is this correct and if so, is there another part of the regex dialect supported by InDesign that can do what I'm looking for? Thanks.