0

We've gotten several files from a professor who published his dictionary and we convinced him to make it open source and make it freely available online. So now I've ended up with several files with the following format (the actual content is not English and encoded UTF-8)

a a is the first letter of alphabet
abacus N a slate used for counting
abbreviate V to shorten a word

and I want this to be in DSL lingvo format which requires headword in one line and definition in next with a tab in front. like

a 
    a is the first letter of alphabet

abacus 
    N a slate used for counting

abbreviate 
    V to shorten a word

Anything with regex? (\r.*) doesn't seem to work as that would select the whole line.

1

Find What: (.*?) (.*)

Replace with: \1\n\t\2\n

Ensure ". matches newline" is disabled.

Notepad++ Find/Replace dialog

The Find RegEx is (lazy) matching all characters up to a space and putting it in one group (without the space), and then matching all remaining characters after the space and putting them in a second group.

The Replace command writes back the first group, then a Newline, then a Tab, then the second group, then another Newline.

Perform a Replace All and:

a
    a is the first letter of alphabet

abacus
    N a slate used for counting

abbreviate
    V to shorten a word
6
  • there's no ".matches newline" option in replace toolbox. And search string finds nothing. – coldbreeze16 Nov 19 '14 at 18:51
  • What version of Notepad++ are you using? Those have been standard options for a long time now. – Ƭᴇcʜιᴇ007 Nov 19 '14 at 19:00
  • edit: I had an older version of notepad++, found the option. Thanks a load, it seems to be working, at least on 80% of the document. The rest is jumbled up because of unusual Unicode characters, gotta fix that manually. – coldbreeze16 Nov 19 '14 at 19:00
  • Excellent, I stuck a screenshot up anyway, just in case. ;) – Ƭᴇcʜιᴇ007 Nov 19 '14 at 19:03
  • Can't thank you enough, I was tearing my hair reading through a RegEx tutorial first time, being a n00b that I am. :p – coldbreeze16 Nov 19 '14 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.