Regex modify the article format: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "=== Purpose === Convert the paragraph from: 1) ... to 1. ... original paragraph: <pre> 1) ... 2) ... </pre> to: <pre> 1. ... 2. ... </pre> === Approach === After enabled...")
 
No edit summary
Line 1: Line 1:
== Case 1: From 1) to (return symbol) 1. ==
=== Purpose ===
=== Purpose ===


Convert the paragraph from: 1) ... to 1. ...
Convert the paragraph from: 1) ... to (return symbol) 1. ...


original paragraph:
original paragraph:
Line 17: Line 19:


After enabled the regular expression of the text editor such as [https://notepad-plus-plus.org/downloads/ Notepad++] or [https://www.sublimetext.com/ Sublime Text] ''$''
After enabled the regular expression of the text editor such as [https://notepad-plus-plus.org/downloads/ Notepad++] or [https://www.sublimetext.com/ Sublime Text] ''$''
* Find: {{kbd | key=<nowiki>\s?(\d+)(\))\s+</nowiki>}}
* Find: {{kbd | key=<nowiki>\s?(\d\d?)(\))\s+</nowiki>}}
* Replace with: {{kbd | key=<nowiki>\n$1\.\s</nowiki>}}
* Replace with: {{kbd | key=<nowiki>\n$1\.\s</nowiki>}}


Line 25: Line 27:
1) Generation Alpha is digitally-orientated and informed, leading to increased brand loyalty and consumer alertness. 2) Mental wellbeing is a key factor in consumer decision making and a disrupted lifecycle pattern will influence consumption habits. 3) Resource scarcity, health and sustainability are key factors for the future of consumption.
1) Generation Alpha is digitally-orientated and informed, leading to increased brand loyalty and consumer alertness. 2) Mental wellbeing is a key factor in consumer decision making and a disrupted lifecycle pattern will influence consumption habits. 3) Resource scarcity, health and sustainability are key factors for the future of consumption.
</pre>
</pre>
== Case 2: From 1. to (return symbol) 1. ==
=== Purpose ===
Convert the paragraph from: 1. ... to (return symbol) 1. ...
original paragraph:
<pre>
1. ... 2. ...
</pre>
to:
<pre>
1. ...
2. ...
</pre>
=== Approach ===
After enabled the regular expression of the text editor such as [https://notepad-plus-plus.org/downloads/ Notepad++] or [https://www.sublimetext.com/ Sublime Text] ''$''
* Find: {{kbd | key=<nowiki>\s?\b(\d\d?\.)\s+</nowiki>}}
* Replace with: {{kbd | key=<nowiki>\n$1 </nowiki>}} Note: end with one whitespace


[[Category:Regular expression]] [[Category:String manipulation]] [[Category:Data Science]]
[[Category:Regular expression]] [[Category:String manipulation]] [[Category:Data Science]]
Anonymous user

Navigation menu