melloware / react-logviewer

React Lazy LogViewer
https://melloware.github.io/react-logviewer/
Mozilla Public License 2.0
52 stars 12 forks source link

Add Regex Search Support #39

Open ido123net opened 2 weeks ago

ido123net commented 2 weeks ago

Feature Request:

Please add regex search functionality to react-logviewer. This would enable more flexible and powerful search options, allowing users to match complex patterns in logs.

I'd be glad to help with a PR if needed! 😊 Keep in mind I'm new to the React world.

Thank you!

melloware commented 2 weeks ago

PR would be great!

melloware commented 2 weeks ago

OK @ido123net i can see why the original developer only did "Knuth–Morris–Pratt" string matching for search. Say you have a very large log file this string searching is way faster and more efficient than an expensive RegExp search.

ido123net commented 2 weeks ago

Yes, I also found it, I will try to leave the KMP part as is.

My idea is to implement a new function to search with regex, this will of-course be less efficient, therefore it will not be the default.

melloware commented 2 weeks ago

I just committed some JS doc changes to document that class just so I know why it was doing it!

ido123net commented 2 weeks ago

@melloware look at #40 it works, but it breaks the highlights and filtering lines.

ido123net commented 2 weeks ago

I just committed some JS doc changes to document that class just so I know why it was doing it!

I saw, I pulled the latest 😉

melloware commented 2 weeks ago

Yep I can point you to wheee the highlighting is happening and why it's not working. Let me review

melloware commented 2 weeks ago

OK the bug is in here: https://github.com/melloware/react-logviewer/blob/3646bca8a1b8886ed2da8dacc42b9e83d49ba322/src/components/Utils/utils.ts#L135-L231

It does some magic tro remove regex strings and do a plain text match on highlighted words.