我想将用户输入到 html 页面上的 textarea 中的内容转换为<p>
-tagged 输出,其中每个<p>
都替换新行。
我正在尝试使用正则表达式,但我无法让它工作。有人会纠正我的表达吗?
String = "Hey, this is paragraph 1 \n and this is paragraph 2 \n and this will be paragraph 3"
Regex = r'(.+?)$'
它只会导致Hey, this is paragraph 1 \n and this is paragraph 2 \n<p>and this will be paragraph 3</p>