The solution is to add the modify u
to the regular expression. With this modifier you indicate that the pattern will be treated as a string UTF-16 and not ASCII.
I attached a screenshot of the change in regex101:
each modifier means:
- i: case insensitive
- u: treat the pattern as UTF-16
- m: multi-line matches
- g: makes a match in a global way, returning all the matches
Finally, I recommend using the i
modifier as the pattern modifier and not as you added it:
/purificación/imug <- trata de forma insensitive TODO el patrón
/(?i)purificación/imug <- trata de forma insensitive **a partir** del donde lo pongas
for example:
/a(?i)purificación/mug
fits with 'apurificación', 'aPURIFICACIÓN', 'aPUrifICAciÓn', etc. Always with the first 'a' lowercase
instead: /apurificación/imug
fits with 'apurificación', 'Apurificación', 'apuRriFICación', etc. It does not matter if the 'a' is uppercase or lowercase.