0

I have set of data points like below, and I am looking for the regular expression to insert " in the beginning of the string and ", at the end of the string.

.NET
C# 
Art Direction
Graphic Design
Brand Development
Online Advertising
Photoshop
Social Media Marketing
Adobe Creative Suite
Marketing
Creative Strategy
InDesign
Logo Design
Social Media
User Interface Design
Digital Media
Integrated Marketing
Marketing Communications
Typography

I tried with ^ it find the start of a single string alone. Then I tried with alt+scroll but the document is so huge to do this. Any help would be appreciated.

Minisha
  • 2,117
  • 2
  • 25
  • 56

1 Answers1

3

Use find-and-replace with the regex option turned on, and replace:

(.*)

with:

"\1"

see screenshot: enter image description here

Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
  • One problem with this regex is for c++ and .net. I get like this "C"++ , ."NET" – Minisha Jun 11 '18 at 03:20
  • You need to turn off the `Whole Word` option as in the screenshot above; it's the button that looks like `""`. – OdatNurd Jun 11 '18 at 03:35
  • Well, I tried with the exact same settings – Minisha Jun 11 '18 at 03:48
  • @Minisha your comment is not clear: this sublime-text regex works on any text regardless of the programming language you're using. – Nir Alfasi Jun 11 '18 at 04:34
  • @alfasin when my data set contains word that starts with dot like: .someword or words that end with plus like: someword++ . The the above regular expression output is ."someword" and "someword"++ – Minisha Jun 11 '18 at 04:41
  • For words that contain special characters at the beginning and at the end, this regex doesn't work. – Minisha Jun 11 '18 at 04:42
  • @Minisha this is the requirement you defined in your question. You did not define special cases. If you have only a few exceptions in the file you can manually fix them and if it's more than that, you can do it in a script (3-4 lines of python can handle it, for example) instead of a regex. – Nir Alfasi Jun 11 '18 at 04:45
  • As I mentioned above, I'd double check that you have the `Whole Word` setting disabled. When it's turned on, Sublime inserts an implicit `\b` around your regex, which stops the match at characters that are considered word separators. The regex as presented above works just fine for me on text like C++` or `.NET` when the option it turned off, but behaves as you describe when it's turned on. – OdatNurd Jun 11 '18 at 05:20