mousesports
mousesports

Reputation: 499

Sublime Text 2 - Regular Expression Find and Replace

I am looking for a solution to find and replace the formatting of many prices within one of my documents.

I currently have prices that are formatting like so: $60 and would like to change the formatting to: 60 $

The following 'Find What' works to find the first format \$\d{0,2} but not too sure about what to 'Replace With'.

Is there a way to preserve the number?

Thank you.

Upvotes: 1

Views: 2220

Answers (2)

Casimir et Hippolyte
Casimir et Hippolyte

Reputation: 89547

Try this:

find: \$(\d{0,2})
replace: \1 $

Upvotes: 3

obimod
obimod

Reputation: 797

Option+Cmd+F:

Place into the find field:

\$([0-9]{0,2})

Place into the replace field:

\1 \$

The backslash + number indicated which capture group to place in there.

Upvotes: 1

Related Questions