Quantcast
Channel: ProZ.com Translation Forums
Viewing all articles
Browse latest Browse all 3915

Converting 2-column list to glossary | Regular expression find and replace could work

$
0
0
Forum: CAT Tools Technical Help
Topic: Converting 2-column list to glossary
Poster: Patrick Porter
Post title: Regular expression find and replace could work

For your second issue...if you have a text editor that allows find/replace with regex...you could use that to find every pair of lines and then take out the line ending in the middle.

If you have Notepad++ (or care to download..it's free)...open the file....press Ctrl+H (for find/replace) and put the following expressions in the corresponding boxes:

Find: (.+?)\t(.+?)\r\n(.+?)\t(.+?)\r\n
Replace: $1\t$2\t$3\t$4\r\n

Make sure to check at the bottom: Search Mode: Regular Expression....and check the box "matches newline"

This will make every second line appear as fields 3 and 4 of the previous line. Make sure that there is a carriage return after the last line (i.e. the file doesn't end at the very end of the last line but at the beginning of a new line.) Also, if you are not on a Windows machine or the file was not created on a Windows machine, then the newline might be \n instead of the \r\n in the expressions above. You can tell by trying a quick find and if nothing comes up then try removing all the \r from the regexes (there are 3 total).

Viewing all articles
Browse latest Browse all 3915