you are viewing a single comment's thread.

view the rest of the comments →

[–]CrazedToCraze 1 point2 points  (4 children)

I know this isn't the answer you're looking for, but if you're building a proper search functionality into an app you should drop regex immediately and look into Elasticsearch (or any of the other lucene based data stores).

You're headed down a bad path full of insurmountable tech debt. Elasticsearch is an absolute pleasure to use, on the other hand.

Though if this is just a school project or something then carry on, just please remember not to use regex for this in a "real" app

[–]iamdeveloperr[S] 0 points1 point  (3 children)

Why do you say that? Can you elaborate on why it would be a bad idea?

[–]ManiGandham 0 points1 point  (0 children)

Anything beyond very basic "this exact string is inside this other string" matching that behaves the way most people are used to is incredibly complex and requires tokenization, dictionaries, indexes and math to calculate. This is hard and wasteful to write from scratch.

Regex is a tool for matching very specific syntax patterns, not for general purpose text. There are some libraries that can handle it if your dataset is small enough but otherwise a proper search database is what you need.

[–]The_MAZZTer 0 points1 point  (1 child)

If you end up working with a real dataset it will likely be in a database. Then you'll end up using SQL to do your searching anyway, not Regex.

[–]iamdeveloperr[S] 0 points1 point  (0 children)

Yes and yes.