Andrea Moro
Andrea Moro

Reputation: 1031

sublimetext: using regular expression for replacing string

I'm trying to clean up an long CSV file using SublimeText instead of Excel.

I've created a RegExp which use some greedy expression like

^.somehting.com.au.$

The search pattern works fine, but when it comes to the replacing everything with a blank string, Sublime return an error in the bottom bar I can barely read as it immediately disappears without anything happening. I do suspect it's an error, and I have read something "too generic" rule or something.

Any help?

Upvotes: 1

Views: 721

Answers (1)

Andrea Moro
Andrea Moro

Reputation: 1031

Ok, Sublime Text use a particular syntax for Reg Expr that slightly differs from the one used in coding. In my specific circumstance, to find a domain in a string using a greedy expression including the carriage return (useful to clean a huge amount of rubbish in an SEO backlinks spreadsheet) I ended up using the following.

.*://leaderlive.co.uk/.*\n

Dots doesn't require escaping ... no need to add the end of string ^$ ... it simply works and I didn't spend time investigating the reasons.

Upvotes: 1

Related Questions