Topic on Project:Support desk

New line character in scribunto/lua regular expression?

5
Summary by Evolution and evolvability
Evolution and evolvability (talkcontribs)

I'm looking at using Module:String#replace to take a multi-paragraph piece of text and return only the first paragraph. I can't seem to find the scribunto/lua way to specify a carriage return or new line. Any ideas?

{{#invoke:String|replace
|source  = INPUTTEXT
|pattern = (.*)NEWLINESYMBOL
|replace = %1
}}


Input:

The quick brown

fox jumps over the

lazy dog


Intended output:

The quick brown

Evolution and evolvability (talkcontribs)
Kghbln (talkcontribs)

I guess it will be best to ask the people who worked on the module for possibilities to implement or for a hint how to use it for you use case.

Evolution and evolvability (talkcontribs)

Ping IAlex, Anomie, Dragons flight as people who were involved in editing early Module:String (apologies to those for whom this isn't relevant, since I found the module's history tricky to track)

Evolution and evolvability (talkcontribs)