Christopher Ng

Christopher Ng

  • NA
  • 5
  • 431

Regex replace, maximum length and unicode support

Jul 2 2020 2:35 AM
I am using
    fs = Regex.Replace(s, ss, sr);
 
In s: ????(4 non english characters)
In ss: ?(.{1,2})?
In sr: ??
 
The problem is, it needs (.{1,6}) instead of (.{1,2}) to replace it.
 
How do I get something like '\p{L}' into that regex.replace so that each letter from any language is a single length?
 
 EDIT: how do I get this form to support non english characters?

Answers (3)