import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "((<.*?):Envelope.*Envelope>)";
final String string = "31-10-2014 00:12:12,075 [INFO] REQUEST:\n"
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:ns2=\"urn:ZEKTransactionService\" xmlns:ns1=\"http://zeksoap.xml.prechku.sys:7001/dvzek/services/ZEKTransactionService\" xmlns:ns3=\"http://impl.zkb.appl.ch\"><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><ns1:closeLeasingMietvertrag><identityDescriptor xsi:type=\"ns2:IdentityDescriptor\"><clientUserId xsi:type=\"xsd:string\">EXPLOIT</clientUserId><name xsi:type=\"xsd:string\">RCISoapUser</name><password xsi:type=\"xsd:string\">ziucx+okpb</password></identityDescriptor><requestEntities xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"ns2:RequestEntity[1]\"><item xsi:type=\"ns2:RequestEntity\"><addressDescription xsi:type=\"ns2:AddressDescription\"><birthdate xsi:type=\"xsd:string\">1961-03-13</birthdate><city xsi:type=\"xsd:string\">Balsthal</city><country xsi:type=\"xsd:string\">CHE</country><datumWohnhaftSeit xsi:type=\"xsd:string\">1990-04-01</datumWohnhaftSeit><firstname xsi:type=\"xsd:string\">Mina</firstname><housenumber xsi:type=\"xsd:string\">.</housenumber><legalForm xsi:type=\"xsd:int\">1</legalForm><name xsi:type=\"xsd:string\">Bilalli</name><nationality xsi:type=\"xsd:string\">XKO</nationality><sex xsi:type=\"xsd:int\">1</sex><street xsi:type=\"xsd:string\">Guntenfluhweg 14</street><zip xsi:type=\"xsd:string\">4710</zip><zivilstandscode xsi:type=\"xsd:int\">1</zivilstandscode></addressDescription><debtorRole xsi:type=\"xsd:int\">0</debtorRole><forceNewAddress xsi:type=\"xsd:int\">0</forceNewAddress><previousReturnCode xsi:type=\"xsd:int\">0</previousReturnCode><refno xsi:type=\"xsd:int\">1</refno></item></requestEntities><leasingMietvertrag xsi:type=\"ns2:LeasingMietvertragDescription\"><anzahlMonatlicheRaten xsi:type=\"xsd:int\">0</anzahlMonatlicheRaten><anzahlung xsi:type=\"xsd:int\">0</anzahlung><bonitaetsCodeIKO xsi:type=\"xsd:int\">4</bonitaetsCodeIKO><bonitaetsCodeZEK xsi:type=\"xsd:int\">5</bonitaetsCodeZEK><datumBonitaetIKO xsi:type=\"xsd:string\">2014-10-30</datumBonitaetIKO><datumBonitaetZEK xsi:type=\"xsd:string\">2014-10-30</datumBonitaetZEK><debtorRole xsi:type=\"xsd:int\">0</debtorRole><ersteGrosseRate xsi:type=\"xsd:int\">0</ersteGrosseRate><filiale xsi:type=\"xsd:int\">0</filiale><grosseSchlussrate xsi:type=\"xsd:int\">0</grosseSchlussrate><herkunft xsi:type=\"xsd:int\">0</herkunft><kennzeichen xsi:type=\"xsd:int\">0</kennzeichen><kreditBetrag xsi:type=\"xsd:float\">0</kreditBetrag><kreditVertragID xsi:type=\"xsd:string\">142051011553</kreditVertragID><monatsrate xsi:type=\"xsd:float\">0</monatsrate><restwert xsi:type=\"xsd:int\">0</restwert><sicherstellungsCode xsi:type=\"xsd:int\">0</sicherstellungsCode><theoRestSaldo xsi:type=\"xsd:float\">0</theoRestSaldo><vertragsStatus xsi:type=\"xsd:int\">0</vertragsStatus></leasingMietvertrag></ns1:closeLeasingMietvertrag></SOAP-ENV:Body></SOAP-ENV:Envelope>\n"
+ " | Thread:http-7001-Processor23";
final Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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