How to check special characters in java code using Java.util.regex package

String guid="first_Name;Last_Name";
Pattern p5 = Pattern.compile("\\p{Punct}");
Matcher m5 =p5.matcher(guid);
boolean test=m5.matches();
I want to find out the weather any speacial characters are there in the String guid using regex.
but above code is always returning false. pls suggest.

Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
Or you could do
Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace.

Similar Messages

  • How to check special characters in view

    hi,
    I have a field in view,in which want to check the field value doesnt contain any special characters.
    the field is a char field and it is not associated to any specific data element.
    Can u please help me in this reg.
    Regards,
    Saujanya

    Hi Saujanya,
                        In my recent reply............i have give the general answer.
    Here is the answer you are  looking for........
    data:
       w_check(37)  TYPE c.
    w_check = sy-abcde.
    concatenate '0123456789' w_check INTO  w_check.
    concatenate '_'   w_check INTO  w_check.
    IF view_name-field_name CO w_check.
    ur code.......
    ELSE.
    Message 'UR text' TYPE 'E'.
    ENDIF.
    Hope,your problem is solved.........
    Reward,if helpful.
    Regards,
    V.Raghavender.

  • Invoke exe through java code(using java.lang.Runtime)

    Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function

    Give "//" for directory seperator.
    E.g. r.exec("c://test//test.exe",null);
    Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
    does not need to be escaped.'
    It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also.

  • How to replace special characters with html code characters automatically?

    A colleague and I work on these html pages. They eventually end up as emails, but we have the cold fusion server to pre process them. One thing we are trying to do is eliminate problems caused by unencoded copyright, trademark and smart quote symbols.
    How could I create an array of find / replace commands in the header so it processes the HTML with correct character codes.
    I"m not cold fusion aware, so any kind of starter info would be great. Eventually I might add more replacements to the array.
    As an example TM (font character) would process to ™ and a smart quote or apostrophe would process to a straight one. an en dash character would become –
    Because we copy paste from places, this often happens and it seems like cold fusion could solve the problem quickly and repeatedly all at once.
    thanks for any help
    -smick

    CF has a built in HTMLEditFormat function for handling <  &  > characters.  For handling trademark and smart quote characters you might try searching for a user defined function at http://cflib.org or writing a user defined function yourself that will handle the specific characters needed in your application.

  • How to check if an email account exists using JAVA??

    Dear friends, I need to check the existence of email accounts before sending them mails to avoid going to a blacklist for sending to non real accounts.
    I was thinking on (SSL)Sockets and smtp commands but I cant get it to work properly I am shooting in the dark here... Is there any easier way to do this or does anyone have any experience on this??
    I have a JAVA application that sends mail to the people that buy certain things but the information quality is bad, so I must check if the mail exists before sending the mail....
    Thanks in advance.

    depending on the scope of the possible target email addresses your requirement may not be possible.
    The SMTP standard has no protocol to verify an email address.
    The reason is that only the target Mail Transfer Agent (MTA) knows if an email adress exists. But your application (representing a Mail User Agent (MUA) aka MailProgramm) only talkes to "its" MTA. The mails may be routed over multiple other MTAs before they finally reach the target MTA which checks if the mail address is known.
    So if the mail addresses to check belong to your own company you may use "whois" service to verify the mail adress. But as soon as the mails leave your company there is no other way of verifying the existence of a mail address than processing the "unreachable" replies.
    bye
    TPD

  • Changing java code using Java program

    hi All,
    I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
    Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
    Thanks,
    Raj.

    no, you got me wrong. After i add the finally blocks,
    i will perform the clean up tasks there. The first
    part of adding the finally blocks,i want to perform
    using a program.No you really don't want to do this.
    a) This will not be easy and in fact will be quite messy.
    b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
    So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start.

  • How to print Special Characters in Sap-Scripts

    How to print Special Characters in Sap-Scripts
    Thanks,
    Ravi

    Hi
    if u want print special characters we can use hot codes i.e '  '  (single inverted commas). in between these hot codes insert u r special characters.
    write    '    !@#$%^&*( )  '.
    for the above write statement output is
    output is   !@#$%^&*( )

  • How to write special characters in PDF using iText

    How to write special characters encoded with UTF-8 in PDF using iText.
    Regards,
    Pandharinath.

    I don't know what your problem is but that's almost certainly the wrong question to ask about it. Java (including iText) uses only Unicode characters. (You may consider some of them to be "special" if you like but Unicode doesn't.) And when it does that, they aren't encoded in UTF-8 or any other encoding.
    So can you describe your problem? That question doesn't make sense.

  • How to display special characters in Script...

    hi all,
    Can any one tell me how to display special characters in script...
    how to write in text element
    thanks in advance,
    prashant

    Hi Prashant ,
      What special characters would you like to include .
    There are a set of characters / icons /symbols that can be included in Script , for that open a window in edit mode and in the menu there will be an option called Insert  , here you can find a lot of characters/symbols that can be included .
    Regards,
    Arun

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • How to check the JDK version of a compiled java file

    can anybody tell me how to check the JDK version of a compiled java file ?
    Edited by: gbhatia8 on Sep 9, 2010 7:04 AM

    The major/minor version of the class file is the way to go.
    Also, it's not necessary to write a separate program to get to those. javap prints them out when being passed the -v flag.
    Note, however that "JDK version" is not a correct term, as I can create 1.4-compatible class files with a Java 6 JDK (by passing the -target flag to javac). Those won't look any different than .class files written with a 1.4 JDK.

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • How can we get requester's user id using java code

    Hi,
    How can we get requester's user id using java code?
    eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm.
    also,
    I have a resoure "A" which on revoking should also revoke resources B and C. How can it be done. Resource A, B, and C are 3 different resource objects.
    ==Thanks,
    doki

    Ok, so there is a way, but it's not available during submission. You can use the findRequests api. From the result set, get the "Requests.Consolidated Data Value" value. In this information, you will get an xml formatted data. It provides the list of users on the request on the left side after submission. After the request is completed, this value is available. Upon completion, you could get the request information, get this value, and parse the information for user ids.
    In the same adapter, use the following API:
    formIntf.setObjectFormData(objInstanceKey, formHash)
    The formHash is a hashtable containing the field name on your object form, and the values you wish to populate it with. You could create a textarea box on your object form and populate the userids for who the request is for.
    However, this makes absolutely 0 sense. When you get a request, the list of userids are listed right there on the request.
    -Kevin

  • How to send sms to mobile from tomcatserver using java code?

    Hi,
    Could you please let me know that,
    How to send sms to mobile from tomcatserver using java code? Please provide the code snippet.
    Thanks in advance.

    Yes, but something needs to send that message. You can't just take an arbitrary computer and send an SMS, it does not have the hardware to do that.
    So either you have a mobile through which you do that or more likely - you use some sort of online service to do it. Whatever choice you make will determine what code you will have to write to get it done. Nobody is going to deliver the code to you, that's your job. It is also your job to figure out what service you are going to use.

  • How to remove special characters while typing data in edit cell in datagrid in flex4

    Hi Friends,
    I am facing this problem "how to remove special characters while typing data in edit cell in datagrid in flex4".If know anyone please help in this
    Thanks,
    Anderson.

    Removes any characters from
    @myString that do not meet the
    provided criteria.
    CREATE FUNCTION dbo.GetCharacters(@myString varchar(500), @validChars varchar(100))
    RETURNS varchar(500) AS
    BEGIN
    While @myString like '%[^' + @validChars + ']%'
    Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
    Return @myString
    END
    Go
    Declare @testStr varchar(1000),
    @i int
    Set @i = 1
    while @i < 255
    Select
    @TestStr = isnull(@TestStr,'') + isnull(char(@i),''),
    @i = @i + 1
    Select @TestStr
    Select dbo.GetCharacters(@TestStr,'a-z')
    Select dbo.GetCharacters(@TestStr,'0-9')
    Select dbo.GetCharacters(@TestStr,'0-9a-z')
    Select dbo.GetCharacters(@TestStr,'02468bferlki')
    perfect soluction

Maybe you are looking for

  • Free sample is coming automatically at the time of PO creation

    Dear all; At the time of creating PO ,the free sample is automatically been ticked so that we can enter net price .what may be the root cause for that? Thanking You; regards; Joydeep Mukherjee

  • Unable to open documents with policies

    We are using a test version of the policy server to evaluate the features of the product. We had some trouble to install the server and to use it with Adobe Professional but now we can protect pdf files with policies. Most of the problems was solved

  • Dynamically naming a file using a send operation in B2B

    Hello, I am using a send operation in B2b adapter which drops a file in a particular location. Right now its dropping a file as default naming standard by B2B. I just wanted to know that is there any way where we can do this dynamically? for eg- fetc

  • Default Mail Font ignored when using "Mail this webpage" in Safari

    This is not really a problem but more of a puzzling irritant.  I often use the "Mail this webpage" option in Safari (the small envelope icon in the tool bar) which opens a draft email with the then-current webpage's URL already embedded in the text a

  • MR11 equivalent for GR non valuated

    Can someone suggest any standard functionality similar to MR11 but applicable for non valuated material. We need to find out IR surplus especially when a GR reversal has been performed. Thanks in advance. Viv