Regular Expression only match if String ends with target

Solution 1:

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.

Solution 2:

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

"string"$

like

xyz$

if you want to end with xzy