开发者

Accented character regex

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èéê]

I开发者_高级运维s it even possible to write a regex for something like this?

Any advice would be much appreciated.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜