import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(&[A-Za-z]+?;)|(<.+?>)|(<\\/\\w+>)|([\\w-]+)|([ ~!@#$%^&*()+=?:;\"\\{\\}\\[\\]|,.\\\\/]+)";
final String string = "This is more<p>Post server upgrade test on 9/13</p><p>Testing c360 release</p><p> </p><p><span title=\\\"Deleted by Chris Courtney - 12/16/2015 3:22pm\\\" class=\\\"del cts-1 non-editable\\\" data-mce-contenteditable=\\\"false\\\" data-time=\\\"1450297379217\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"4\\\">wifi</span><span title=\\\"Inserted by Chris Courtney - 12/16/2015 3:23pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1450297385376\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"8\\\">Life Preserver will</span> save <span title=\\\"Inserted by Chris Courtney - 12/16/2015 3:23pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1450297399510\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"28\\\">if the </span>internet cut<span title=\\\"Inserted by Chris Courtney - 12/16/2015 3:23pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1450297404606\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"35\\\">s </span>out<span title=\\\"Inserted by Chris Courtney - 12/16/2015 3:23pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1450297409071\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"42\\\">.</span><span title=\\\"Deleted by Chris Courtney - 12/16/2015 3:23pm\\\" class=\\\"del cts-1 non-editable\\\" data-mce-contenteditable=\\\"false\\\" data-time=\\\"1450297406872\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"37\\\"> test</span></p><p> </p><p>The Subject Property is owned by the Federal Deposit Insurance Corporation (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of between[STREETNAME] and [].porperty ocne upon a tmie The Subject Property is not currently occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE]. This is me entering new text into 2.1. This is a bullet. Type text 123 spelling</p><p> </p><p>The Subject Property is owned by the <span title=\\\"Deleted by Chris Courtney\\\" class=\\\"trackChanges\\\">Federal Deposit Insurance Corporation</span> (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of between[STREETNAME] and []. The Subject Property is not currently occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE]. This is me entering new text into 2.1.</p><p> </p><p>This is a bullet.EDR order right after (discussed geocoding concerns, we're all set there) test</p><p> </p><p>Type text 123 spelling The Subject Property is owned by the Federal Deposit Insurance Corporation (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of<span title=\\\"Added by Chris Courtney\\\" class=\\\"trackChanges\\\">/</span><span title=\\\"Deleted by Chris Courtney\\\" class=\\\"trackChanges\\\"> </span>between[STREETNAME] and [].</p><p> </p><p> </p><p>The Subject Property is not currently occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE].</p><p>This is me entering new text into 2.1. test</p><p> </p><p>This is a bullet.</p><p> </p><p>Type text 123 spellingThe Subject Property is owned by the Federal Deposit Insurance Corporation (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of between[STREETNAME] and [].</p><p> </p><p> </p><p>The Subject Property is not currently occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE].</p><p>This is me entering new text into 2.1.</p><p> </p><p>This is a bullet.</p><p> </p><p>Type text 123 spellingThe Subject Property is owned by the Federal Deposit Insurance Corporation (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of between[STREETNAME] and [].</p><p> </p><p> </p><p>The Subject Property is not currently occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE].</p><p>This is me entering new text into 2.1.</p><p> </p><p>This is a bullet.</p><p> </p><p>Type text 123 spellingThe Subject Property is owned by the Federal Deposit Insurance Corporation (FDIC) and consists of 10 Acres acres and is located on the [N/E/S/W] side of 440 Wheelers Farms Road, approximately [###] feet [N/E/S/W] of the intersection of between[STREETNAME] and [].</p><p> </p><p> </p><p>The Subject Property is not currentl<span title=\\\"Inserted by Chris Courtney - 06/12/2015 2:40pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1434134407587\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"2\\\">y</span> <span title=\\\"Inserted by Chris Courtney - 06/12/2015 2:40pm\\\" class=\\\"ins cts-1\\\" data-time=\\\"1434134414659\\\" data-username=\\\"Chris Courtney\\\" data-userid=\\\"4642\\\" data-cid=\\\"3\\\">this is a test. </span>occupied by [BRIEFLY DESCRIBE BUILDING, OCCUPANT AND USE].</p><p>This is me entering new text into 2.1.</p><p> </p><p>This is a bullet.</p><p> </p><p>Type text 123 spelling</p><p> </p><p>2014 Schultz Motors of Milan<br> 2009-2008 Dive Rite<br> Procom Driving Services<br> Schultz Motors of Milan - New and Used<br> Schultz Motors of Milan -Part and Service<br> 2004-2003 Adventure Driving<br> Dive Rite<br> Procom Driving Services<br> Schultz Motors of Milan - New and Used<br> Schultz Motors of Milan -Part and Service<br> 1999-1998 Dive Rite<br> Procom Driving Services<br> Schultz Motors of Milan - New and Used<br> 1994-1983 Schultz Motors<br> 1979-1967 Bruckner Oldsmobile</p><p> </p><p> 132543467</p><p> </p><p> </p><p> </p><p> </p>Heh?";
final String subst = "|";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html