views:

23

answers:

1

I'm trying to create a regex that will look for french words whether a user specifies the accented characters or not. So if the the user has searched for "déclaré" but types in declare instead I would like to be able to match the text still. I'm having difficulty making this more dynamic so that it can be matched on any french word...

Closest example from another user from a different post was:

d[eèéê]cl[aàáâ]r[eèéê]

Is it even possible to write a regex for something like this?

Any advice would be much appreciated.

+1  A: 

I had once to create something like that.

The best thing I could come up with was something akin to having a dictionary of known letters with diacritics and replace them on the search terms, before creating a pattern for a regular expression.

Pretty much like you did on your own example.

Paulo Santos