Regular expression to search for Gadaffi

后端 未结 15 1776
鱼传尺愫
鱼传尺愫 2020-12-07 07:05

I\'m trying to search for the word Gadaffi. What\'s the best regular expression to search for this?

My best attempt so far is:

\\b[KG]h?add?af?fi$\\         


        
15条回答
  •  抹茶落季
    2020-12-07 07:22

    \b[KGQ]h?add?h?af?fi\b

    Arabic transcription is (Wiki says) "Qaḏḏāfī", so maybe adding a Q. And one H ("Gadhafi", as the article (see below) mentions).

    Btw, why is there a $ at the end of the regex?


    Btw, nice article on the topic:

    Gaddafi, Kadafi, or Qaddafi? Why is the Libyan leader’s name spelled so many different ways?.


    EDIT

    To match all the names in the article you've mentioned later, this should match them all. Let's just hope it won't match a lot of other stuff :D

    \b(Kh?|Gh?|Qu?)[aeu](d['dt]?|t|zz|dhd)h?aff?[iy]\b
    

提交回复
热议问题