Alfonse
Alfonse

Reputation: 49

Adding Quotation marks around string with regex

I have a text file to process, with huge number of lines like this:

000AA Sylvester Stallone

000AD Demi Moore

I would add for each word, a single quotation mark like this:

'000AA' 'Sylvester' 'Stallone'

'000AD' 'Demi' 'Moore'

I suppose that the best(and maybe the only way?) is to use notepadd++ find/replace with regex, but unluckily I have not enough knowledge. Please, there is someone can help me? This will be a huge time saver help!!

Upvotes: 2

Views: 14459

Answers (1)

dognose
dognose

Reputation: 20909

Just search for

([^\s]+) 

(Matches every character but any whitespace)

and replace it with

'$1'

(replaces the match with the same string, but leading and trailing ')

Upvotes: 13

Related Questions