问题
I want to remove inline style from an html document in ST2.
I imagine my regex will be something like this style=\"*\"
If that's wrong, it doesn't matter. I'm sure I'll figure out the expression I'll need.
What I haven't been able to figure out, is how to actually use a regex to find or to find and replace text in ST2. The docs say that it can be done. But I can't find the documentation for how to do it.
回答1:
Simply open the Search+Replace function (via Ctrl-H or the menu bar) and check the first box on the left of it (the one with an '*' on it, or you can press Alt+R)
Then the search field will be used as a Regex, and you can use the found patterns using the usual $1, $2, $3 vars in the replace box
More info here
回答2:
I had a similar task to perform, the regex I used in the manner that Nas62 suggested was
style=\"(.*?)\"
回答3:
Find What : style=".*"
Replace With : leave it as blank
Click Replace All button.
来源:https://stackoverflow.com/questions/11733370/how-do-i-do-a-regex-search-and-replace-in-sublime-text-2