Comments (7)
This works for me:
return [w.strip() for w in re.split(r'[\n,,#%&$/ ]', s, re.M)]
Turns out that in a regular expression, you need to specify that you're in multiline mode
Hope this helps.
from cc-cedict-for-anki.
Works great! Thanks! now it's possible to mass-add new cards from lists made in many other programs
from cc-cedict-for-anki.
Sure, I'll add it in the next update, but I don't know when this will be. If you want to add it yourself on your end, you can just add your separators in this line in the meantime.
from cc-cedict-for-anki.
@ThoreBor
Thanks, great!
Tried \n for new line, it didn't work. How to add new line feed to the separators?
Tabs worked when I just added it to the string (literally just hit 'tab' button on my keyboard).
Space also worked (the self space, after hitting the keyboards 'space bar').
I only didn't find how to add the new line feed for word lists like:
**
美国
德国
俄国
法国
英国
日本
...
Here (and in text editors) it looks like multiline text (which it actually is), but in the addon search field it's shown as a single line with some hidden separators which is new line feeds:
But when I copy this new line feed sign and paste it to this string:
31 return [w.strip() for w in re.split(r'[,,#%&$/ ]', s)]
the line is broken into two lines:
31 return [w.strip() for w in re.split(r'[,,#%&$/
]', s)]
and addon shows error.
What symbol should be added to this string in the main.py
file for the addon to render new line feeds signs as input search words separators?
from cc-cedict-for-anki.
Great! I'll add this to the next version then, as it might be useful for other people as well.
from cc-cedict-for-anki.
I only added tab to your line for tab-fans ))
This resulted in:
return [w.strip() for w in re.split(r'[\n,,#%&$/ ]', s, re.M)]
from cc-cedict-for-anki.
Actually the search method you implemented is so awesome I wish Anki had it as built-in option in Anki's own search dialog.
Of course the already present in Anki search regexp is powerful and can do almost everything - but your natural and intuitive search, where you can just copy-paste and instantly have your desired words filtered (without preformatting of the query) - is much more simple, even for people who aren't even aware of regexps )).
can your implementation be also applied to the Anki's own search dialog? as a built-in option or an addon?
from cc-cedict-for-anki.
Related Issues (20)
- Cantonese support HOT 8
- KaiTi font family not found HOT 4
- Feature: auto detect input HOT 14
- Not asking users to select field mappings multiple times HOT 2
- Feature: Add tags using card creation dialogue HOT 1
- Bug: "1 new card was added" HOT 2
- Feature: Colour pinyin according to tone HOT 3
- v1.3-beta: Error when attempting to install HOT 2
- Some vocab entries don't map correctly to the note's fields HOT 2
- When will the new 1.3 version be released? HOT 3
- Make it possible for the window to be resized to a smaller size HOT 3
- "Each field could only be used once" issue HOT 12
- Adding card to deck - search function freezes app (Not Responding) HOT 3
- definition field contains commas but cards are created without them (only a space separating definitions), they are hard to read. Also, can the cursor be positioned on the search bar when opening the add-on window? HOT 2
- Issue Using the Search Feature in CC-CEDICT Add-on HOT 2
- Certain cards would trigger an Invalid search error HOT 3
- Something doesn´t work, I dont know if it´s my fault HOT 1
- Adding some words causes an error HOT 1
- Anki reports an error an requests a restart while looking up words
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cc-cedict-for-anki.