Comments (11)
Ok, great! I can see use cases here, so I'm going to do it.
from highlight-words.
Hey @eriknyk, thanks for trying it out!
Could you try this:
stacktraceChunks = highlightWords({
text: item.stackTrace,
query: '/(com.mycompany[\.0-9a-z]+)/'
});
Notice the /
missing from your query.
Cheers,
Bogdan
from highlight-words.
Ok, cool! I'll polish everything and publish the new version. Thanks for testing and for your suggestion
from highlight-words.
@eriknyk 1.2.0 is published. I'd appreciate a final run through
from highlight-words.
I just can say THANK YO USO MUCH! @tricinel
from highlight-words.
Hey @eriknyk, thanks for getting in touch! Hmm, I haven't considered that use case, so it's not possible at the moment. I'm specifically escaping anything that might look like a regex. I guess it's something we could not do. We could check if the term is a regex and, if it is, let it pass through, otherwise escape as I do now.
I'd like to write some test cases first.
Would you mind sharing a few examples of what you had in mind? Mock code will do just fine.
from highlight-words.
Yeap for sure, Thanks @tricinel
my principal use case is when I want to highlight words with a given pattern like /com.mycompany.com[\.0-9a-z]+/
in this case I want to highlight all strings like
com.mycompany.com.authorization.config
com.mycompany.com.core
com.mycompany.com.controllers.invoices
patterns like that in a very very long text like we have in the android logcat crash reports.
Thanks a lot
from highlight-words.
@eriknyk something like this.
I published 1.2.0 as a beta. I need to polish it a bit and update the docs, but this should give you an idea and you can tell me if it fits your purpose :)
https://www.npmjs.com/package/highlight-words/v/1.2.0-beta.0
npm install [email protected]
or the yarn
equivalent should work I think.
You'll see the example for your test case here - and notice that you'll need to use a capture group, i.e. /(com.something.something.else)/
for the split to work properly.
from highlight-words.
Awesome @tricinel,
however, I've update to
"highlight-words": "^1.2.0-beta.0",
but the regex not working.
My code:
stacktraceChunks = highlightWords({
text: item.stackTrace,
query: '(com.mycompany[\.0-9a-z]+)'
});
from highlight-words.
It works perfectly!
thank you so much @tricinel
from highlight-words.
Ah, very nice! Glad it's working! You're very welcome
from highlight-words.
Related Issues (10)
- ESM Support HOT 14
- Invalid query type HOT 2
- This work with IE browser? HOT 1
- Query words with double spaces HOT 4
- Option to ignore diacritics HOT 1
- Declaration file not found with `Node16` module + moduleResolution HOT 12
- Option Proposal: `maxLength` HOT 9
- Investigate potential performance issues HOT 3
- New Option: `clipByLength` HOT 5
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 highlight-words.