Vladislav Mavrin
Vladislav Mavrin

Reputation: 33

Find and replace with regular expression in Sublime Text 2

Could anybody please help me to make a regular expression to search and replace a specific text in Sublime Text 2?

I need to find #=* where * can be any number from one to three digits and replace it with nothing.

I try the following regex: \#={1,3}

Upvotes: 1

Views: 1035

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 626690

To match a text starting with #= and followed by 1 to 3 digits, you can use

#=[0-9]{1,3}

See the regex demo. Beside [0-9], you can match digits with a \d shorthand character class, or a Unicode category \p{N}.

Note that # is not a special regex metacharacter and needs no escaping.

Upvotes: 1

Related Questions