3 ms·
What is a use case in searching everyday text webpages for which regexes would help, in your experience?
by tokenadult 17y ago
What is a use case in searching everyday text webpages for which regexes would help, in your experience?
- gnosis 17y agoWell, here's an example of a search that can be done with regexes, but not with a simple boolean word/phrase search: Find a word/phrase (not)followed closely but not immediately by another word/phrase, with arbitrary characters in between (regexes would allow you to specify exactly how many arbitrary characters between these words/phrases there were). For each of the constituent words/phrases, regexes also allow alternatives to be specified. I suppose the same could be done with multiple ordinary searches, but regexes make doing this much easier and more convenient. With regexes you can search for fragments of a word. I've seen some ordinary search engines sometimes automatically search for a root word with various endings, but that's not quite the same. Something else that regexes allow that no ordinary search engine does (as far as I know) is searching for non-alphanumeric characters. This can be a lifesaver, to disambiguate some words, or to make sure you're only searching for something at the beginning or end of a sentence (or in a heading, maybe delimited by a dash or a colon). Those are just a few things off the top of my head. I'm sure lots of other use-cases would present themselves, once you started using such search engines regularly (pardon the pun).