Regular Expression only match if String ends with target

前端 未结 2 1023
忘了有多久
忘了有多久 2020-11-30 11:00

I need a regular expression that will only match to the String if it ends with the target that I am looking for. I need to locate a file with a specific extension, problem i

相关标签:
2条回答
  • 2020-11-30 11:31

    Use an end anchor ($):

    .*\.ccf$
    

    This will match any string that ends with .ccf, or in multi-line mode, any line that ends with .ccf.

    0 讨论(0)
  • 2020-11-30 11:34

    $ is used to match the end of the string. and can be used like

    "string"$
    

    like

    xyz$
    

    if you want to end with xzy

    0 讨论(0)
提交回复
热议问题