Compare two strings by ignoring certain characters

前端 未结 5 768
梦毁少年i
梦毁少年i 2021-01-20 07:38

I wonder if there is an easy way to check if two strings match by excluding certain characters in the strings. See example below.

I can easily write such a method by

5条回答
  •  有刺的猬
    2021-01-20 08:03

    You can of course test the regex w/out substitution:

    [a-zA-z]{3}.[a-zA-z]{3}
    

    Seems like a common use for regex, so why the avoidance?

提交回复
热议问题