Sublime Forum

How to find a word + a special character?

#1

Hello !

I’m trying to find any word that ends with this special character “-”.
For exemple cat- , mouse-, tiger- . More specifc to find any letter + that special character.

Thanks

0 Likes

#2

For a plugin or using the search feature?

If you use the search feature - make sure the icon which is: .* is highlighted to allow Regular Expressions then simply search for:

\w+-

\w would be normal alphanumeric chars so everything you’d normally see in a word - possibly numbers… the + means 1 or more characters will match instead of only the last… and - being the hyphen…

If you want to make sure there is a space after, then you can add a space after -, or anything else…

if you’d rather define a charset replace \w with [a-zA-Z_] to match upper and lower a-z and underscores, keep the + for 1 or more and the hyphen after the + so it is what is at the end…

You can also use this for find in files, etc…

0 Likes