Help with Java and Regular Expression

Hello,
I have one line of Java and regular expression that I got from the web :
String[] opt;
opt = line.split("\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
If "line" contains :
1 "Hello World"
this code would give me :
opt[0] : 1
opt[1] : "Hello World"
which is almost what I would like to do except for the double quotes. I wonder if someone could please help me change the regular expression so that it would return :
opt[0] : 1
opt[1] : Hello World
Thank you and Best Regards,
Chris

It looks to me like this is a line from a space delimited file so you should use one of the free CSV parsers such as http://opencsv.sourceforge.net/ . These will handle the quotes properly even if a field actually contains a quote.

Similar Messages

  • [solved] Need a little help with sed and regular expressions

    Hello!
    I am shure this is something easy for most of you
    I want to make a script, which converts filenames of my ripped MP3s (replaces '_' with spaces, removes leading track numbers...)
    But I have some problems:
    j=$(echo $j | sed 's/_\+/ /g')
    j=$(echo $j | sed 's/^[0-9]{0,3}//g')
    j=$(echo $j | sed 's/[^ ]-[^ ]/ - /g')
    j=$(echo $j | sed 's/_\+/ /g') << this is working fine (converts all "_" to spaces)
    j=$(echo $j | sed 's/^[0-9]{0,3}//g') << is NOT working, why??
    For Example in "01-somebody_feat_someone-somemusic.mp3" the leading "01" number is NOT being removed..
    j=$(echo $j | sed 's/[^ ]-[^ ]/ - /g') << how can I insert spaces before and after the "-"?
    So that "someone-somemusic" becomes "someone - somemusic" (but only where "-" is surrounded by letters)
    Last edited by cyberius (2011-07-27 18:50:54)

    For sed, you must escape { and } to use them as you want (just slap a \ before them).
    For the last expression, capture the letter before/after the dash -- use \( and \) -- and then substitute it for something like "\1 -" and then "- \1". You'll want to split this into two pieces, one for the front and one for the back so you can get "somemusic -someband" the way you want without a bunch of cases.
    Edit: Or, you could just do a replace for "-" to be " - " and then have another expression to reduce spaces. I see you've used \+ before, so I'm guessing you can figure that out
    Also, sed has the -e switch so you can do multiple different expressions with one invocation.
    Also (also), have you looked into something like Picard with automatic track renaming? You can even customize how they are renamed.
    Edit (2): Also^3, check out prename. There are different versions, ones which use PCRE and ones that use other standards, but it is for renaming files based on regular expressions, which is what you're doing. In any case, you might want to put you script into the User made scripts thread when you feel more comfortable and get some more critiquing, if you're interested.
    Last edited by jac (2011-07-26 23:13:27)

  • Help with php and regular expressions

    I am making a package and would like php to execute sed - command during setup (when user goes to installation php page and submits info). Like this:
    exec("sed -i 's|^.*$db_host.*$|$db_host="$HOST";|' config.php");
    exec("sed -i 's|^.*$db_user.*$|$db_user="$IPUSER";|' config.php");
    exec("sed -i 's|^.*$db_password.*$|$db_password="$IPUSERPASS";|' config.php");
    exec("sed -i 's|^.*$db_name.*$|$db_name="$DBNAME";|' config.php");
    exec("sed -i 's|^.*$url_base.*$|$url_base="$URLBASE";|' config.php");
    Apparently something is wrong with escapes because sed never gets any matches that it would replace.

    phrakture wrote:
    mmgm wrote:
    cactus wrote:and there is no reason to stick a .* on the front of the regexp. Just make sure the variables have no blank space at the start of the line in front of them.
    Making sure you have no blank space before the variable is quite a demand for people obsessed with tabbing, like me.
    I swear, if my tab key ever breaks, I'm gonna start smashing things.
    I'm such a clean-code-whore.
    but this is a config file... do you really tab out your config files?
    Config files are usually ment to be human-readable. This is why they usually contain comments and such. Tabbing makes code more readable and therefore I find it usefull in any file which contains text of any sort. In the end, it's going to make your life a whole lot easier.

  • Need help with JAVA and Listeners

    Thanks to all the people who have been helping me so far. I really appreciate it. I have another question.
    I am bulding a GUI where it will consist of buttons and textfields. I want the textfields to display data but also permit the user to interact, i.e. enter data into the textfield and then when the enter key is depressed my program will evaluate the data and determine to use it or throw a pop up error window. If the data is acceptable than that textfield will change accordingly and depending on the data might possibly update the two other textfields.
    I know there is an ActionListener for JButtons and a MouseListener. Is there a Listener for the enter key? What would be a simple method to implement my logic? Thanks again! I really appreciate, hopefully I can become more fluent in JAVA!

    Swing related questions should be posted in the Swing forum.
    enter data into the textfield and then when the enter key is depressed my program will evaluate the data and determine to use it Well, JTextField supports an ActionListener, which means an ActionEvent is fired when focus is on the text and and the Enter key is used.
    However, what happens if the user uses the Tab key to move from field to field, then no event is fired and the Action Event is not generated. Maybe you can use an InputVerifier which will cause the text field to be validated when the text field loses focus.
    Or, maybe you are talking about activating the "Enter" button when the enter key is pressed no matter what component has focus. In this case you should be using getRootPane().setDefaultButton(...);
    Your need to clarify your requirement.

  • Help with java and adobe

    I have CS6 and ever since I installed Yosemite on my mac none of my adobe products will open and it keeps giving me a message saying I must install legacy java se 6. I updated my java already and I am still running into issues. Please help

    needhelpnow,
    Did you download from here,
    http://support.apple.com/kb/DL1572
    or what happens if you do?

  • Java and Regular Expression

    Hi all,
    i confuse why the follwoing code replace the date with first one in string
    String inputString= "hell to yemen on 8 JAN 2012 or on 11 FEB 2004";
    Matcher m2 = Pattern.compile("([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC|JANUARY|FEBRUARY|MARCH|APRIL|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER) ([0-9]{4})", Pattern.CASE_INSENSITIVE).matcher(inputString);
      String  resultString=null;
    String temp_str=null;
    String first=null;
      String second=null;
       String month=null;
    while (m2.find()) {
        if (m2.groupCount()==3) {
        first = m2.group(1);
             second = m2.group(2);
             month = m2.group(3);
           System.out.println("three parts"+month);
            temp_str=m2.replaceAll(first+"-"+second+"-"+month);
              //temp_str=m2.replaceFirst(second)
           System.out.println(temp_str);
    }the expected reults is
    hell to yemen on 8-JAN-2012 or on 11-FEB-2004not why the like this that now appear
    hell to yemen on 8-JAN-2012 or on 8-JAN-2012Edited by: 973907 on 07-Jan-2013 02:34

    Many thanks for you.
    you are right but now the when i print the string appear only half of it why?
    String inputString="hell to yemen on 8 JAN 2012 or on 11 FEB 2004 hi 12 MAR 2009 or on 11 MAY 2005 or 08 2007 and can be 2011 DEC or 2 ";
    Pattern p = Pattern.compile("([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC|JANUARY|FEBRUARY|MARCH|APRIL|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER) ([0-9]{4})");
        StringBuffer sb = new StringBuffer();
        String candidateString = inputString;
        String replacement = null;
    String first=null;
      String second=null;
       String third=null;
        Matcher matcher = p.matcher(candidateString);
        while (matcher.find())
             first = matcher.group(1);
             second = matcher.group(2);
             third = matcher.group(3);
       replacement = first+"-"+second+"-"+third;
    if (matcher.groupCount()==3) {
        matcher.appendReplacement(sb, replacement);
        String msg = sb.toString();
        System.out.println(msg); the results is :
    hell to yemen on 8-JAN-2012 or on 11 FEB 2004 hi 12-MAR-2009but the expected results is :
    hell to yemen on 8-JAN-2012 or on 11-FEB-2004 hi 12-MAR-2009 or on 11-MAY-2005 or 08 2007 and can be 2011 DEC or 2 JULY or JUN 2  uuu"
    {code}
    Edited by: 973907 on Jan 8, 2013 2:39 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Events problem with (Java and ActiveX)

    Hi,
    I use an ActiveX component with Java and i've got a problem with events.
    Java classes were generated with Bridge2Java (IBM).
    In order to manage events I added a listener in my application :
         javaMyActiveX = new MyActiveX();
         javaMyActiveX.add_DMyActiveXEventsListener(new _DMyActiveXEventsAdapter());
    I also added a constructor in the _DMyActiveXEventsAdapter class and I fill the body of methods.
    The ActiveX generates two types of events :
    - The ones are directly generated by methods.
    - The others are generated by a thread.
    With MS Products (VB, Visual C++, Visual J++), I catch all events.
    With java (jdk 1.4), I catch only events generated by methods.
    Can anyone help me.

    I'm not 100% sure, but the last time I used that bridge, it only worked if you ran your Java app within a Microsoft VM.

  • Help with java mapping

    PI File adapter has a processing option u2018Empty-Message Handlingu2019 to ignore or Write Empty Files. In case there is no data created after mapping on target side then this option determines whether to write an empty file or not. But there is a catch to this option when it comes to using it with File Content Conversion which is described in SAP Note u2018821267u2019. It states following:
    I configure the receiver channel with File content conversion mode and I set the 'Empty Message Handling' option to ignore. Input payload to the receiver channel is generated out of mapping and it does not have any record sets. However, this payload has a root element. Why does file receiver create empty output file with zero byte size in the target directory?  Example of such a payload generated from mapping is as follows:                                                           
    <?xml version="1.0" encoding="UTF-8"?>                          
    <ns1:test xmlns:ns1="http://abcd.com/ab"></ns1:test>
    solution :
    If the message payload is empty (i.e., zero bytes in size), then File adapter's empty message handling feature does NOT write files into the target directory. On the other hand, if the payload is a valid XML document (as shown in example) that is generated from mapping with just a root element in it, the File Adapter does not treat it as an empty message and accordingly it writes to the target directory. To achieve your objective of not writing files (that have just a single root element) into the target directory, following could be done:
    Using a Java or ABAP Mapping in order to restrict the creation of node itself during mapping. (This cannot be achieved via Message Mapping)
    Using standard adapter modules to do content conversion first and then write file. 
    can someone help with java mapping that can be used in this case?

    Hi,
        You have not mentioned the version of PI you are working in. In case you are working with PI 7.1 or above then here is the java mapping code you need to add after message mapping in the same interface mapping
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class RemoveRootNode extends AbstractTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    public void transform(TransformationInput arg0, TransformationOutput arg1)
              throws StreamTransformationException {
         // TODO Auto-generated method stub
         this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    In case you are working in PI 7.0 you can use this code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveRootNode implements StreamTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    The code for PI 7.0 should also work for PI 7.1 provided you use the right jar files for compilation, but vice-versa is not true.
    Could you please let us know if this code was useful to you or not?
    Regards
    Anupam
    Edited by: anupamsap on Dec 15, 2011 9:43 AM

  • Discussion Forum Portlet - Problems with JAVA and UTF8?

    Hi
    I installed the Discussion Forum Portlet successfully. It also seems that almost everything works fine. There's only a problem if I have new posts that include special German characters (Umlaute) like ä, ö, ü or special French characters like é, è or ç. They are saved correctly in the table but if you view the post the characters are not displayed correctly.
    Example
    input: ça va?
    result: ça va?
    I know that there are problems with Java and UTF8 Database. Is there a possibility to change this (bug)?
    Regards
    Mark

    Here's what I got. I don't see anything that helps but I'm kinda new to using SQL and java together.
    D:\javatemp\viddb>java videodb
    Problem with SQL java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver
    ] Syntax error in CREATE TABLE statement.
    Driver Error Number-3551
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in
    CREATE TABLE statement.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at videodb.main(videodb.java:31)
    D:\javatemp\viddb>

  • 3 tiers model with Java and Oracle.

    Hi everybody. I have a problem with my work. I want to design a simple program follow 3 tiers model with Java and database is Oracle. But I do not know how I can design them. Please help me. It will better if you give some source code for each layer.
    Thanks in advance.
    Ky Thanh.

    I'd suggest searching the net for tutorials. Pick out the things you don't know about and need to know (SQL? JDBC? Java? software design in general?) and google: tier architecture, sql tutorial, etc. Sun's Java & JDBC tutorials are at http://java.sun.com/learning/tutorial/index.html
    Source for each tier? Read the JDBC tutorial and you can write the database tier source yourself. Learn Swing/Servlets/whatever you use for the user interface and you can write the top tier. The middle tier is your business logic, which is dependent on your area of business, and you'll need to know about the business and just general programming. Then if the tiers need to be distributed (hopefully not), you'll need to learn EJB or something.
    I hope you haven't been given a task there you aren't ready to take on... Learning to swim by jumping into the river is a great way to learn in a school assignment, but you mention work, and learning that way at work sounds a bit risky to me.

  • Problem with java and pogo games

    i use mozilla and now with the problems with java and hackers cannot play my pogo games,what can i do? i disabled my java i tried java 6 doesnt work or is not safe,what is a safe way to play games on pogo that use java?

    Oracle has released a Java 7 Update 11 to address security vulnerabilities and you should update to that version.
    *https://support.mozilla.org/kb/how-to-use-java-if-its-been-blocked
    See also:
    *http://kb.mozillazine.org/Java#Windows_installation_issues
    You can find the latest Java version on the Oracle website.
    See Java Platform > Java SE 7U11 and Java 6U38 (Download JRE)
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • The performance of management system with Java and MySQL

    Hi all,
    I want to develop one management application with Java and MySQL. However I am not sure which is a good way to design the system. The system has to deal with customers' data in the database.
    Should I create objects for every customers when application starts so that I do not need to access to the database often? Or
    Should I access to the database everytime the user want to deal with customer's data?
    Welcome for any suggestion.
    Thank you
    Pat

    Hi
    i i think u should go through MVC model or use connection pooling

  • Urgent help(xml, java and  asp)

    Hi all,
    I,m new with XML and i have to convert a VB application that connects to an ASP using Microsoft XML and I need to know if I can connect from a java application to an ASP using XML for transfering the infornation.
    In the ASP side it uses DOM, and I would like not to touch the ASP and create a new application with java and get rid of the VB application

    DrClap what I have in the VB side is this:
    Private Function SetBalanceForReal(Amount As Currency, Action As String) As Boolean
    On Error GoTo ehSetBalance
    Dim ohttp As New MSXML.XMLHTTPRequest
    Dim oResponseXML As New MSXML.DOMDocument
    Dim oDoc As New MSXML.XMLDSOControl
    Dim oElement As MSXML.IXMLDOMElement
    Dim oNode As MSXML.IXMLDOMNode
    ohttp.open "POST", ServerUrl & "ActualizaBalance.asp", False
    Set oElement = oDoc.XMLDocument.createElement("ActualizaBalance")
    Set oNode = oElement.appendChild(oDoc.XMLDocument.createNode(1, "Client", ""))
    Set oNode = oElement.appendChild(oDoc.XMLDocument.createNode(1, "Action", ""))
    Set oNode = oElement.appendChild(oDoc.XMLDocument.createNode(1, "Amount", ""))
    oElement.childNodes.Item(0).Text = Trim(ClientLogin)
    oElement.childNodes.Item(1).Text = Action
    oElement.childNodes.Item(2).Text = Amount
    ohttp.send (oElement.xml)
    oResponseXML.loadXML (ohttp.responseText)
    If oResponseXML.documentElement.childNodes.Item(1).Text = "OK" Then
    Available = oResponseXML.documentElement.childNodes.Item(0).Text
    Else
    Available = 0
    End If
    Set ohttp = Nothing
    Set oResponseXML = Nothing
    Set oDoc = Nothing
    Set oElement = Nothing
    Set oNode = Nothing
    SetBalanceForReal = True
    Exit Function
    ehSetBalance:
    Set oNode = Nothing
    Set oElement = Nothing
    Set oDoc = Nothing
    Set oResponseXML = Nothing
    Set ohttp = Nothing
    Available = 0
    SetBalanceForReal = False
    End Function
    Public Function GetConsecutive(Game As String) As Boolean
    On Error GoTo ehGetConsecutive
    Dim ohttp As New MSXML.XMLHTTPRequest
    Dim oResponseXML As New MSXML.DOMDocument
    Dim oDoc As New MSXML.XMLDSOControl
    Dim oElement As MSXML.IXMLDOMElement
    Dim oNode As MSXML.IXMLDOMNode
    ohttp.open "POST", ServerUrl & "ObtieneConsecutivo.asp", False
    Set oElement = oDoc.XMLDocument.createElement("ObtieneConsecutivo")
    Set oNode = oElement.appendChild(oDoc.XMLDocument.createNode(1, "Game", ""))
    oElement.childNodes.Item(0).Text = Game
    ohttp.send (oElement.xml)
    oResponseXML.loadXML (ohttp.responseText)
    Consecutive = oResponseXML.documentElement.childNodes.Item(0).Text
    Set ohttp = Nothing
    Set oResponseXML = Nothing
    Set oDoc = Nothing
    Set oElement = Nothing
    Set oNode = Nothing
    GetConsecutive = True
    Exit Function
    ehGetConsecutive:
    Set oNode = Nothing
    Set oElement = Nothing
    Set oDoc = Nothing
    Set oResponseXML = Nothing
    Set ohttp = Nothing
    Consecutive = 0
    GetConsecutive = False
    End Function
    and the ASP code is this:
    <%@LANGUAGE=VBScript%>
    <%
         'Variables Simples
         Dim Cliente
         Dim Accion
         Dim Monto
         'Variables Complejas
         Dim oClienteBD
         Dim oClienteInfoXML
         Dim oDoc
         Dim oElemento
         Dim oNode
         'Inicializacion de Variables Complejas
         Set oClienteBD = Server.CreateObject("Casino_Clases.CClient")
         Set oClientInfoXML = Server.CreateObject("MSXML.DOMDocument")
         Set oDoc          = Server.CreateObject("MSXML2.DSOControl")
         oClientInfoXML.async=false     
         oClientInfoXML.load(Request)
         Cliente = oClientInfoXML.documentElement.childNodes.item(0).text
         Accion = oClientInfoXML.documentElement.childNodes.item(1).text
         Monto = oClientInfoXML.documentElement.childNodes.item(2).text
         Set oElemento = oDoc.XMLDocument.createElement("Resultado")
         Set oNode = oElemento.appendChild(oDoc.XMLDocument.createNode(1, "AVAILABLE",""))     
         Set oNode = oElemento.appendChild(oDoc.XMLDocument.createNode(1, "ESTADO",""))
         If oClienteBD.UpdateBalance(Cliente, Accion, Monto) = True Then
              If oClienteBD.GetClientBalance(Cliente) = True Then
                   oElemento.childNodes.Item(0).Text = oClienteBD.Available
                   oElemento.childNodes.Item(1).Text = "OK"
              else
                   oElemento.childNodes.Item(0).Text = 0
                   oElemento.childNodes.Item(1).Text = "BAD"
              end If
         else
              oElemento.childNodes.Item(0).Text = 0
              oElemento.childNodes.Item(1).Text = "BAD"
         end If
         Response.Write(oElemento.xml)
         Set oClientInfoXML = Nothing
         Set oDoc = Nothing
         Set oClienteBD = Nothing
         Set oNode          = Nothing
         Set oElemento     = Nothing
    %>
    What I need to do is to change the VB part for a Java application and basicly, I don't know what Class of Java I have to use to connect to the ASP.
    If you were so kind of giving me an example to do this I will appreciate it.
    Ocorella

  • Validate form entries: does java support regular expressions?

    i want to validate form entries, does java support regular express like javascript?

    Just recently in 1.4 regex was finally introduced :)
    Take a look at http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/

Maybe you are looking for