• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Grep reverse character order

Explorer ,
Dec 11, 2024 Dec 11, 2024

Copy link to clipboard

Copied

I have an InDesign file with headers of bank names in Chinese.

The problem is that the Chinese characters need to be reversed.

Is there a way to create a GREP expression to search for word(s) of any length, and then reverse the entire string of characters? I will be restricting the search to a given paragraph style that has only been applied to the bank names.

For example, if the string in question is ABCD, the desired result is DCBA.

TOPICS
How to

Views

94

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 11, 2024 Dec 11, 2024

Copy link to clipboard

Copied

… Supposing the Starting point is "ABCD" (in capitals) and the Arrival point is "DCBA"!

 

3 simple Regex!

 

In my sample, the biggest word is "EFGHIJKLMN" that has 10 chars. So you will need to play:

 

Regex "_Fridnge_1" once

Regex "_Fridnge_2" 10 times (until no match!)

Regex "_Fridnge_3" once

 

Of course, with a tool as Multi-Find/Change, you just need 1 click!

 

0.png1.png2.png3.png

 

(^/)  The Jedi

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2024 Dec 12, 2024

Copy link to clipboard

Copied

The Jedi's solution is slick, as usual, but I fear it won't work in your case, as that solution is built around searching for \u, meaning A Single Uppercase Letter, and that won't capture any Chinese characters. I suppose one could replace each instance of \u with something like [\x{2E80}-\x{9FBB}] which should capture most Chinese characters. (There are exceptions, like for full-width punctuation. If you wind up using a solution like this, there are easy ways to test to find out if all of your glyphs are being caught by the Unicode-value regex I provided above, like applying a highlight character style to visually review, which can be deleted from the document once you've done your QA.)

 

But, if you don't mind my asking... why? Why are bank names mirror-reversed in your document? I'd suspect that maybe they've accidentally have some right-to-left text setting applied, which could just be turned off. That'd be less risky than trying to reverse glyph order. 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 13, 2024 Dec 13, 2024

Copy link to clipboard

Copied

LATEST

Hi Joel,

 

My starting point (without more info) was F/R based on Capitals but it could be any char including its font style!

(just replacing "\u" by ".")

Here, I've used the "Adobe Myungjo Std" font:

 

Capture d’écran 2024-12-13 à 16.39.15.png

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines