Regex to find only all colon after a digit

hi.

I’m struggling to find a regex that allows me to find all colon after a digit like this

7-8:

or

11:

but not, for instance,

apple:
pie:
whatever word:

only colons after a digit, as I said

Do you have any tip to achieve this? thanks in advance for help

the simple regex being \d: or [0-9]:
the details for cabalistic additions being not even mentionned here : List of Regular Expressions
you’ll have to go to there : Regular Expressions | ICU Documentation
and scroll down down and down :

1 Like

as far as you know, these regex are compatible with the GREP feature of find and replace in Indesign?

Regular expressions that work in LibreOffice work in InDesign most of the time – only very few adjustments are necessary, if at all. The only difference I’m currently aware of (but there may be more) is that if you search for a specific Unicode character, in LibreOffice you need to use \uXXXX whereas in InDesign you need to use \x{nnnn}.

For example, if you search for U+1E17 LATIN SMALL LETTER E WITH MACRON AND ACUTE, enter \u1E17 in LibreOffice but \x{1E17} in InDesign.

E.g.
(?<=\d):

4 Likes

many thanks. It seems to work like a charm!

If interested in Regex a bit more:

  1. There is a very good tutorial here.
  2. RegEx come with different flavours. LibreOffice uses the RegEx engine by ICU. Details here.
  3. The construct used by my answer is a "Look Behind Assertion".
2 Likes