import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "\\/\\*(.|\\n|\\r)*\\*\\/";
final String string = "\n"
+ "package es.elcorteingles.ns.integrations.schema.omnistoreordernotification._2_0;\n\n"
+ "import javax.xml.bind.annotation.XmlAccessType;\n"
+ "import javax.xml.bind.annotation.XmlAccessorType;\n"
+ "import javax.xml.bind.annotation.XmlType;\n\n\n"
+ "/**\n"
+ " * Contiene informacion del coste a nivel de\n"
+ " * ShippingGroup.\n"
+ " * - Importe total.\n"
+ " * - Importe pendiente a cobrar.\n"
+ " * - Importe\n"
+ " * del gasto de envÃo\n"
+ " * \n"
+ " * \n"
+ " * <p>Java class for ShippingGroupPriceInfoType complex type.\n"
+ " * \n"
+ " * <p>The following schema fragment specifies the expected content contained within this class.\n"
+ " * \n"
+ " * <pre>\n"
+ " * <complexType name=\"ShippingGroupPriceInfoType\">\n"
+ " * <complexContent>\n"
+ " * <restriction base=\"{http://www.w3.org/2001/XMLSchema}anyType\">\n"
+ " * <sequence>\n"
+ " * <element name=\"totalCost\" type=\"{http://www.elcorteingles.es/ns/integrations/schema/OmniStoreOrderNotification/2_0}AmountType\" minOccurs=\"0\"/>\n"
+ " * <element name=\"pendingCost\" type=\"{http://www.elcorteingles.es/ns/integrations/schema/OmniStoreOrderNotification/2_0}AmountType\" minOccurs=\"0\"/>\n"
+ " * <element name=\"shippingCost\" type=\"{http://www.elcorteingles.es/ns/integrations/schema/OmniStoreOrderNotification/2_0}AmountType\" minOccurs=\"0\"/>\n"
+ " * <element name=\"groupDiscountsAmount\" type=\"{http://www.elcorteingles.es/ns/integrations/schema/OmniStoreOrderNotification/2_0}AmountType\" minOccurs=\"0\"/>\n"
+ " * <element name=\"totalNetAmount\" type=\"{http://www.elcorteingles.es/ns/integrations/schema/OmniStoreOrderNotification/2_0}AmountType\" minOccurs=\"0\"/>\n"
+ " * </sequence>\n"
+ " * </restriction>\n"
+ " * </complexContent>\n"
+ " * </complexType>\n"
+ " * </pre>\n"
+ " * \n"
+ " * \n"
+ " */\n"
+ "@XmlAccessorType(XmlAccessType.FIELD)\n"
+ "@XmlType(name = \"ShippingGroupPriceInfoType\", propOrder = {\n"
+ " \"totalCost\",\n"
+ " \"pendingCost\",\n"
+ " \"shippingCost\",\n"
+ " \"groupDiscountsAmount\",\n"
+ " \"totalNetAmount\"\n"
+ "})\n"
+ "public class ShippingGroupPriceInfoType {\n\n"
+ " protected AmountType totalCost;\n"
+ " protected AmountType pendingCost;\n"
+ " protected AmountType shippingCost;\n"
+ " protected AmountType groupDiscountsAmount;\n"
+ " protected AmountType totalNetAmount;\n\n"
+ " /**\n"
+ " * Gets the value of the totalCost property.\n"
+ " * \n"
+ " * @return\n"
+ " * possible object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public AmountType getTotalCost() {\n"
+ " return totalCost;\n"
+ " }\n\n"
+ " /**\n"
+ " * Sets the value of the totalCost property.\n"
+ " * \n"
+ " * @param value\n"
+ " * allowed object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public void setTotalCost(AmountType value) {\n"
+ " this.totalCost = value;\n"
+ " }\n\n"
+ " /**\n"
+ " * Gets the value of the pendingCost property.\n"
+ " * \n"
+ " * @return\n"
+ " * possible object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public AmountType getPendingCost() {\n"
+ " return pendingCost;\n"
+ " }\n\n"
+ " /**\n"
+ " * Sets the value of the pendingCost property.\n"
+ " * \n"
+ " * @param value\n"
+ " * allowed object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public void setPendingCost(AmountType value) {\n"
+ " this.pendingCost = value;\n"
+ " }\n\n"
+ " /**\n"
+ " * Gets the value of the shippingCost property.\n"
+ " * \n"
+ " * @return\n"
+ " * possible object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public AmountType getShippingCost() {\n"
+ " return shippingCost;\n"
+ " }\n\n"
+ " /**\n"
+ " * Sets the value of the shippingCost property.\n"
+ " * \n"
+ " * @param value\n"
+ " * allowed object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public void setShippingCost(AmountType value) {\n"
+ " this.shippingCost = value;\n"
+ " }\n\n"
+ " /**\n"
+ " * Gets the value of the groupDiscountsAmount property.\n"
+ " * \n"
+ " * @return\n"
+ " * possible object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public AmountType getGroupDiscountsAmount() {\n"
+ " return groupDiscountsAmount;\n"
+ " }\n\n"
+ " /**\n"
+ " * Sets the value of the groupDiscountsAmount property.\n"
+ " * \n"
+ " * @param value\n"
+ " * allowed object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public void setGroupDiscountsAmount(AmountType value) {\n"
+ " this.groupDiscountsAmount = value;\n"
+ " }\n\n"
+ " /**\n"
+ " * Gets the value of the totalNetAmount property.\n"
+ " * \n"
+ " * @return\n"
+ " * possible object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public AmountType getTotalNetAmount() {\n"
+ " return totalNetAmount;\n"
+ " }\n\n"
+ " /**\n"
+ " * Sets the value of the totalNetAmount property.\n"
+ " * \n"
+ " * @param value\n"
+ " * allowed object is\n"
+ " * {@link AmountType }\n"
+ " * \n"
+ " */\n"
+ " public void setTotalNetAmount(AmountType value) {\n"
+ " this.totalNetAmount = value;\n"
+ " }\n\n"
+ "}\n";
final String subst = "";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceFirst(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