Re: Erlang re docs

Loïc Hoguin <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Organization Nine Nines
Message-ID <[email protected]>
On 31/01/2021 00:25, Lloyd R. Prentice wrote:
> Hi Igor,
> 
>> ...you get "compile, inspect, replace, run, split", and that really is pretty much all there is to it. I mean, you write a regex, you compile it, you run it on a string and check the matches.
> 
> You’ve pretty much just written a nice succinct tutorial. Explain why we 
> may  need to compile the regex, e.g. rather than just run the regexp 
> from the parameter field, add well-selected examples for each function, 
> and now we have a document from which one can get the gist with a rapid 
> look up. A footnote pointing to useful details might round it out.

It's already there.

"Compiling the regular expression before matching is useful if the same 
expression is to be used in matching against multiple subjects during 
the lifetime of the program. Compiling once and executing many times is 
far more efficient than compiling each time one wants to match."

Anyway if you think things would be better done another way, send a PR.

-- 
Loïc Hoguin
https://ninenines.eu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.