InDesign uses Perl-compatible regular expressions (pcre). Getting a Unicode character into the replacement string is done by \x{XXXX} where XXXX is the hexadecimal character code:

2\x{2009}$5

But in general you can replace by any character you can type. Just put actual thin spaces into your search-and-replace dialog:

3 $5

You can use your OS's utilities to grab the thin space from the list of available characters, for Windows it's the "Character Map" tool, where the thin space can be found in the "General Punctuation" Unicode sub-range. Searching for "thin space" works as well. MacOS has the "Character Viewer", which can do the same thing.

Answer from Tomalak on Stack Overflow
🌐
Reddit
reddit.com › r/powershell › find and replace unicode by regex
r/PowerShell on Reddit: find and replace unicode by regex
July 8, 2019 -

i have several strings of characters that have unicode at the end of them. I would like to do a find with regex and replace the unicode with the specified characters.

30May19Bel©
13Jun18Bel¬
24Aug17Sar«

I would like to do a find and replace with regex

for example [0-9]{2}[a-zA-Z]{3}[0-9]{2}[a-zA-Z]{3}©

$path = 'C:temp\uni.txt'
$original_file = C:temp\uni.txt"
$destination_file = "C:temp\update.txt"
(Get-Content $original_file) | Foreach-Object {
    $_ -replace '¨', '1'`
     -replace '©', '2'`
     -replace 'ª', '3'`
     -replace '«', '4'`
     -replace '¬', '5'`
     -replace '°', '6'`
     
    } | Set-Content $destination_file

and replace it with

30May19Bel2
13Jun18Bel5
24Aug17Sar4

This may be a caveman approach, and I know nothing about regex. If there is a better way, i am unaware of it, but totally open to someone dropping the egg of knowledge on me. It just seemed like the easiest way was to create a Rosetta Stone of sorts. Thanks, Rogue

Top answer
1 of 5
12

Adapted from Semplice, following link from here.

[^\x00-\x80] matches any character not in the ASCII range.
Note that some of the characters may not be encoded correctly from the copy and paste.

var latin_map = {"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","Ꞇ":"T","Ꝭ":"IS","Ĵ":"J","Ɉ":"J","Ḱ":"K","Ǩ":"K","Ķ":"K","Ⱪ":"K","Ꝃ":"K","Ḳ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","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","ᶃ":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj","ſ":"s","ẜ":"s","ẛ":"s","ẝ":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ᴑ":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","ꝸ":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","ᶌ":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"};

function embolden( str, chr ){
    return str.replace( /[^\x00-\x80]/g,
        function (a) { 
            return chr == latin_map[a] ? '<b>' + a + '</b>' : a;
        } 
    );
}

embolden( 'ádám', 'a' );    // "<b>á</b>d<b>á</b>m"
2 of 5
3

I've tried this code, see if it's what you're looking for:

'ádám'.replace(/./g,function(char){
    switch(char.toLowerCase()){
        case 'á':
        case 'à':
        case 'â':
        case 'ã':
            return '*';
        break;
    }
    return char;
});

EDIT:

To replace all chars that don't belong to the ASCII table, just check if the char has a char code up to 127, since the ASCII table char codes are defined between 0 and 127 (notice that á doesn't belong to the Unicode table, but to the Extended ASCII table, that comes from 0 up to 255):

'ádám'.replace(/./g,function(char){
    return char.charCodeAt(0)<=127 ? char : '<b>' + char + '</b>';
});
🌐
Reddit
reddit.com › r/vba › [word] insert unicode character in regexp.replace string
r/vba on Reddit: [Word] Insert Unicode character in RegExp.replace string
March 26, 2022 -

So my regex pretty much matches what it needs to (I hope), but now I'd like to make replacements that insert certain special characters. As an example, I'd like to insert a narrow non-breaking space (\u202F) between a number and its unit. The number and the unit are already being captured in their respective capture group, so now I only need to create the correct replacement string.

I kinda expected "$1\u202F$2" to work, but unfortunately that just prints out silliness like 200\u202Fm.

I also tried "$1" & Chr(8239) & "$2", which compiled, but did literally nothing.

🌐
Stack Overflow
stackoverflow.com › questions › 39849114 › regex-js-replace-character-by-unicode
regex js: Replace character by unicode - javascript
October 4, 2016 - .replace(/.\?/g, '&#8239;?') ... I my example, I would like to add narrow no-break space between the C and the ? on the last sentence. ... converts zero or more space or narrow non break space characters in text, followed by '!' or '?', into a single narrow non break space character followed by the '!' or '?' character matched (tested in Firefox and IE).
🌐
Xojo Programming Forum
forum.xojo.com › general
Regex fails if the source string contains the Unicode replacement character - General - Xojo Programming Forum
November 2, 2023 - This regex: Var instr, outstr As String ro = new RegExOptions ro.CaseSensitive = False ro.ReplaceAllMatches = True re = new RegEx re.Options = ro re.SearchPattern = "\s\s+" re.ReplacementPattern = " " outst…
🌐
AutoHotkey
autohotkey.com › board › topic › 97682-how-can-i-specify-unicode-characters-in-regexreplace-replacement-parameter
How can I specify unicode characters in RegExReplace replacement parameter? - Ask for Help - AutoHotkey Community
September 18, 2025 - Also, if you are using a Unicode version of AHK make sure that your script is saved as UTF-8 and not ANSI. That aside, regex applies to the needle parameter only; it is not used in the replacement parameter. To get the characters you should be able to enter them in as literal text or call their equivalent using the Chr() function.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › RegExp › unicode
RegExp.prototype.unicode - JavaScript - MDN Web Docs
Surrogate pairs will be interpreted as whole characters instead of two separate characters. For example, /[😄]/u would only match "😄" but not "\ud83d". When lastIndex is automatically advanced (such as when calling exec()), unicode regexes advance by Unicode code points instead of UTF-16 code units.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › a › 65820952
regex - How to replace Unicode characters in the following scenario using javascript? - Stack Overflow
January 21, 2021 - text = 'abc𝑢𝑣𝑤𝑥𝐚𝐛𝐜𝐝𝒇𝒈𝒉𝒊'; text = text.replace(/([a-z]+)/,'<span class="regular">$1</span>'); text = text.replace(/([𝑎𝑏𝑐𝑑𝑒𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤...
🌐
LearnByExample
learnbyexample.github.io › learn_js_regexp › unicode.html
Unicode - Understanding JavaScript RegExp
// extract all consecutive letters // \p{L} is an alias for \p{Letter} > 'fox:αλεπού,eagle:αετός'.match(/\p{L}+/gu) < ['fox', 'αλεπού', 'eagle', 'αετός'] // extract all consecutive Greek letters // \p{sc} is an alias for \p{Script} > 'fox:αλεπού,eagle:αετός'.match(/\p{sc=Greek}+/gu) < ['αλεπού', 'αετός'] // delete all characters other than letters > 'φοο12,βτ_4,fig'.replace(/\P{L}+/gu, '') < 'φοοβτfig' // extract whole words not surrounded by punctuation marks > 'tie. ink east;'.match(/(?&LT!\p{P})\b\w+\b(?!\p{P})/gu) < ['ink'] See MDN: Unicode character class escape for more details.
🌐
Regular-Expressions.info
regular-expressions.info › unicode.html
Regex Tutorial: Introduction to Unicode Regular Expressions
Even though the first code points beyond U+FFFF were assigned way back in 2001 with Unicode 3.1.0, a lot of software, including Windows itself, is still designed around 16-bit characters. Such software uses surrogate pairs to handle code points between U+10000 and U+10FFFF. This can upset your regex engine’s handling of astral characters.
🌐
Unicode
unicode.org › reports › tr18
UTS #18: Unicode Regular Expressions
At this level, the regular expression engine also accounts for extended grapheme clusters (what the end-user generally thinks of as a character), better detection of word boundaries, and canonical equivalence. This is still a default level—independent of country or language—but provides much better support for end-user expectations than the raw level 1, without the regular-expression writer needing to know about some of the complications of Unicode encoding structure. ... Level 1 is the minimally useful level of support for Unicode. All regex implementations dealing with Unicode should be at least at Level 1.
🌐
Community
community.safe.com › home › forums › fme form › transformers › replace unicode character in kml
Replace Unicode character in KML - FME Community
August 1, 2017 - Try the following regex in a StringReplacer, it will replace any character in a certain unicode range (in the below example it's the range 0800-FFFF) with the replacement text of your choice:
🌐
Microsoft
social.msdn.microsoft.com › Forums › en-US › b2746983-1c57-463e-81d7-cb9d891d89dd › regex-to-remove-unicode-characters
RegEx to remove unicode characters? | Microsoft Learn
September 15, 2021 - Match the character's unicode range between u0600 and u06FF. If you want to show Arabic characters just add its range in it. ... string s = "NAAAH A. ABCDEF ص ب 16633 انرíاض 11934انسظæدíة"; s = Regex.Replace(s, @"[^\u0000-\u007F\u0600-\u06FF]+", string.Empty);
🌐
Hugging Face
discuss.huggingface.co › 🤗tokenizers
Use Unicode blocks in regex (in Replace normalizer) - 🤗Tokenizers - Hugging Face Forums
November 29, 2022 - In python, I can use Unicode blocks in regex to filter out characters that I don’t want. For example : import regex as re sentence = "This is ènglish ㅕㅛㅇㄴㅁㅇ ㅇ!" print(re.sub("[^\p{InBasicLatin}\p{InLatin-1Supplement}]", "", sentence) # -> 'This is ènglish !'
🌐
Python.org
discuss.python.org › python help
Regex for unicode letter - Python Help - Discussions on Python.org
February 24, 2021 - I want to create a regex to match a Unicode letter followed by any number of letters, digits, spaces, hyphens, or underscores. If the first bit was just an ASCII letter then it is easy: [A-Za-z][-\w ]* But what do I re…