2

I'm trying to search using M-s o or M-x occur. The string that I'm searching for may or may not have an acute accent, eg, "Martín" or "Martin". The output is showing only the terms that has the acute accent (Martín), but I need the term without the acute accent (Martin) in the output also.

How do I get the search to ignore the accents?

1

Try searching for this regular expression: \bMart[ií]n\b. the \bs match word boundries (so that you don't match "Martini" etc., and the [ií] matches i or í. There might be a better regexp, but I think this should work just fine if you are using it from occur or with isearch-forward-regexp (C-M s by default).

You can also simply search for the regular expression \bMart.n\b. The dot matches any single character except newline. If you do not have too many words like Marten the additional matches should not disturb you too much.

  • You beat me with your answer;-). So I just added some supplementary stuff from mine to yours. Hope you do not mind. – Tobias Jan 9 '16 at 15:11
  • @Tobias I modified your additions slightly because the OP was asking specifically about occur – elethan Jan 9 '16 at 15:33
  • Elethan, Thank you for your reply. The regexp works perfectly, however I was searching for something like the comment above: " Related question: Incremental search for un/accented characters – Juancho 2 days ago ". Best Regards. – Matias Fernandez Jan 12 '16 at 14:37
  • So it looks like you'll have to wait for emacs 25. Trying to implement a general solution in emacs 24 is likely going to be a very large undertaking, which is then rendered obsolete as soon as emacs 25 is out. – Harald Hanche-Olsen Feb 8 '16 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.