Grep for the win: Difference between revisions
mNo edit summary |
|||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Limitation of SuperMemo= | =Limitation of SuperMemo search feature= | ||
SuperMemo search is limited to plain text and there is no | SuperMemo search is limited to plain text and there is no support for regular expressions as searches are implemented using assembly language. This is not the end. You can overcome such limitation by using a third party tool and searching into the files externally. My prefered choice is grepWin, a free and open source solution. | ||
=GrepWin= | =GrepWin= | ||
[[File:Grepwin.logo.png|right|64px]] | |||
'''grepWin''' is a simple search and replace tool which can use regular expressions to do its job. This allows to do much more powerful searches and replaces. | '''grepWin''' is a simple search and replace tool which can use regular expressions to do its job. This allows to do much more powerful searches and replaces. | ||
Line 10: | Line 12: | ||
==HTML search== | ==HTML search== | ||
=HTML search&replace== | === HTML collection search=== | ||
* searching for a specific CSS class, from wiki, online dictionary etc. | |||
* searching for a word of expression inside a specific tag. | |||
** searching for wikipedia portals | |||
=== regular expression search=== | |||
* searching for words or phrases for collocations using regular expressions. | |||
* search text containing certain scripts (Greek, Cyrillic, devanagari, Kanji, etc) | |||
=== Cross collection HTML search=== | |||
Perhaps the biggest perk of using grep is that you can access to all .htm files in your SuperMemo, not limited to a particular collection. This is specially useful if you use multiple collections in the same language. | |||
==HTML search&replace== | |||
'''Limitation: If you change the text in HTM files, SuperMemo won't see the changes until that file is loaded in the Element Window. ''' | |||
=== Changing the color of the hard-coded styled blue text when splitting topics=== | |||
search for: <nowiki><font color="blue"></nowiki> | |||
replace by: <nowiki><font class="bluesplit"></nowiki> | |||
I recomend using a CSS class instead of hard-coding a different color. CSS class have an advantage of style to any color via template which you could change any time, or even have different colors for different templates. | |||
=== Deleting the colon left when splitting topics=== | |||
=== Converting HTML clozes to plain text in bulk=== | |||
Search for: <nowiki><span class=cloze>[...]</span></nowiki> | |||
Replace by: [...] | |||
=== Adding HTML code for conventions === |
Latest revision as of 17:46, 19 January 2022
Limitation of SuperMemo search feature
SuperMemo search is limited to plain text and there is no support for regular expressions as searches are implemented using assembly language. This is not the end. You can overcome such limitation by using a third party tool and searching into the files externally. My prefered choice is grepWin, a free and open source solution.
GrepWin
grepWin is a simple search and replace tool which can use regular expressions to do its job. This allows to do much more powerful searches and replaces.
Download: GitHub
HTML search
HTML collection search
- searching for a specific CSS class, from wiki, online dictionary etc.
- searching for a word of expression inside a specific tag.
- searching for wikipedia portals
regular expression search
- searching for words or phrases for collocations using regular expressions.
- search text containing certain scripts (Greek, Cyrillic, devanagari, Kanji, etc)
Cross collection HTML search
Perhaps the biggest perk of using grep is that you can access to all .htm files in your SuperMemo, not limited to a particular collection. This is specially useful if you use multiple collections in the same language.
HTML search&replace
Limitation: If you change the text in HTM files, SuperMemo won't see the changes until that file is loaded in the Element Window.
Changing the color of the hard-coded styled blue text when splitting topics
search for: <font color="blue">
replace by: <font class="bluesplit">
I recomend using a CSS class instead of hard-coding a different color. CSS class have an advantage of style to any color via template which you could change any time, or even have different colors for different templates.
Deleting the colon left when splitting topics
Converting HTML clozes to plain text in bulk
Search for: <span class=cloze>[...]</span>
Replace by: [...]