Skip to content

Latest commit

 

History

History
20 lines (10 loc) · 497 Bytes

StructureText.md

File metadata and controls

20 lines (10 loc) · 497 Bytes

Algorithm

  1. Common Replace with space

1.1 Regex: PCRE (PHP)

(?|( +)|(\t+)|(\f+)|(...)|…|([xX]?(\(\s+\d\s+\)))) (?|( +)|(\t)|(\f)|(^(\r\n))(\n|\r)(\n|\r)+|(\r\n(\r\n)+)|(...)|([xX]?(\(\s+\d\s+\))))

$str=str_replace("<hr />","<hr/>",str_replace("\n\n", "\n", str_replace("\r\n", "\n", str_replace("&nbsp;","",trim($str))))); 2. Remove from Text

  1. Replace with Newline

  2. Conditionally remove/replace

Helpful sites: https://www.debuggex.com/, https://regex101.com/