Regular expression: check for the presence of special characters.

I have the following requirement:
I need to check for the presence of the following characters in a keyword: @, #, > if any of these characters are present, then they need to be stripped off, before going further. Please let me know the regular expression to check for these characters.

I am trying to extend the same logic for the following characters:
.,‘“?!@#%^&*()-~<>[]{}\+=`©® . here is the code fragment:
Pattern kValidator = Pattern.compile("[\\.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]");
Matcher kMatcher = kValidator.matcher(keyWord);
if (kMatcher.find(0)) {
keyWord = keyWord.replaceAll("[.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]", " ");
}I get the following error. This error is from the weblogic command window. I dont understand these special characters.
Error:
28 Oct 2008 12:27:48 | INFO  | SearchController   | Exception while fetching search results in controller:Unclosed character class near index
39
[\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                       ^
java.util.regex.PatternSyntaxException: Unclosed character class near index 39
[\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                       ^
        at java.util.regex.Pattern.error(Pattern.java:1650)
        at java.util.regex.Pattern.clazz(Pattern.java:2199)
        at java.util.regex.Pattern.sequence(Pattern.java:1727)
        at java.util.regex.Pattern.expr(Pattern.java:1687)
        at java.util.regex.Pattern.compile(Pattern.java:1397)
        at java.util.regex.Pattern.<init>(Pattern.java:1124)
        at java.util.regex.Pattern.compile(Pattern.java:817)

Similar Messages

  • Regular expression check in form

    Hi All,
    I am trying to plugin Regular expression check on the user form, for different fields. Can I do it in a java file and call this java class file in the validation part? if yes how can i do it if no what are the other alternatives?
    Thanks in advance

    I did the following using Xpress and a regular expression "if (/\D/.test(Val))" in JavaScript to check for non-numeric characters in a field.
              <Field name=':variables.approvalSAPID'>
                <Display class='Text'>
                  <Property name='title' value='SAP ID of Approving Manager'/>
                  <Property name='required'>
                    <Boolean>true</Boolean>
                  </Property>
                  <Property name='maxLength' value='8'/>
                  <Property name='size' value='8'/>
                  <Property name='help' value='SAP ID of the person who is being asked to approve request'/>
                </Display>
                <Validation>
                  <cond>
                    <and>
                      <eq>
                        <length>
                          <ref>:variables.approvalSAPID</ref>
                        </length>
                        <i>8</i>
                      </eq>
                      <script>
                          var Val = env.get(':variables.approvalSAPID');
                          testMe(Val);
                          function testMe (Val) {
                                                 if (/\D/.test(Val))
                                                    return (false);
                                                 else
                                                    return (true);
                        </script>
                    </and>
                    <null/>
                    <s>! The SAP ID of the Approving Manager must be an 8 digit number !</s>
                  </cond>
                </Validation>
              </Field>
    Larry L. Viars
    Sr. Systems Programmer
    Enterprise Systems Management
    CenterPoint Energy LLC.

  • How do I test for the presence of an active open document in Photoshop?

    I’m new to Adobe scripting, and one of my first scripts deals with the activeDocument in Photoshop.
    If there is no activeDocument, I want to display a message and terminate the script.  My efforts
    so far have been met with frustration.  While developing the script in ExtendScript Toolkit,
    I used the  test expression "activeDocument in app", and everything worked as expected. And when I installed the script
    in the Photoshop scripts folder and ran it from Photoshop with a document open, it also worked.
    But when I ran the script from Photoshop with no document open, it failed.
    Moreover, after that,the script failed when I tried to run it in ESTK.
    I did some testing and found that my test expression, "activeDocument in app"
    was returning true, even though no document was open.
    Still in ESTK, I replaced the “app” with ”Application” in the test expression.  That worked when
    I stepped through the script.  But when I tried to run it without stopping, it stopped at the
    test expression, and displayed the error message, “Application is undefined.”
    So how do I test for the presence of an open document in Photoshop ??

    After posting this, I discovered the Photoshop Scripting Forum, and I found my answer there.—
    I should have used “app.Documents.length” as my test expression.

  • Checking for the existence of a file.

    I have a GUI to enter test info. A file is created based on the entered test number. I want to check for the existence of a file, and then notify the operator while not allowing the program to save it.

    This vi checks the presence of the input file.
    If file is not found, it will be created.
    regards
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    File_check_existance_openorcreate_2003.vi ‏72 KB

  • I need to verify my Apple ID. i know my e-mail address and the password, but what websit do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

    i know my e-mail address and the password, but what website do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

    i know my e-mail address and the password, but what website do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

  • I just buy iPhone4 first hand on Jan 07,2013 but the warranty expire date How can i check for the date of production?

    I was bought iPhone4 16 GB on Jan 07, 2013 from online shop from Laos they told me that this iPhone from Apple in Hongkong (first hand) but I check for the warranty is already expire date. What should we do? I want to know about my iPhone4 first hand or second hand. How can i check?

    This will show you warranty status and give you an idea
    of when originally sold:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How can I check for the existence of an XML file in Illustrator Javascript??

    I'm writing a Javascript to run at startup. I want to check for the existence of XML files and process them, if they are available. How can I check for their existence?

    Your first line just sets a variable to a string value… getFiles() is a method of Folder… so
    var InputXMLDir = Folder( "D:/Brackets/Create_Bracket_Graphics/Input/XML-n-Templates/" );
    Not a PC user so I can't remember if the colon is OK…? As you appear to know the file name why bother with a folder get files anyhow you could just check if the file exists then do some thing…
    alert( File( "D:/Brackets/Create_Bracket_Graphics/Input/XML-n-Templates/brackets_men_web.xml" ).exists );

  • F110 payment run completed but not generated all check for the payments

    Do any one have an idea or the potential answer on my query
    I've run F110 and generated one Payment all 45 open items for one vendor
    Now after the print done only the first 20 items got into the check register, and left over the remaining 25 items
    So my question is why system not generated the check for the remaining 25 items and what is the remedy

    No all settings are available, but still the same situation the all checks are not generated for all items of the vendor open items clearing in the one payment documents
    single vendor
    single payment for all 25 open items
    After print activity compelted
    checks created for items 5
    leftover items 20 not created check
    can anyone tell why system is behaving like this

  • How to check for the sub folder in the document library Is already Exist using CSOM?

    Hi,
    My requirement is to create the  folder and sub folder in SharePoint document library. If already exist leave it or create the new folder and the subfolder in the Document library using client side object model
    I able to check for the parent folder.
    But cant able to check the subfolder in the document library.
    How to check for  the sub folder in the document library?
    Here is the code for the folder
    IsFolder alredy Exist.
    private
    string IsFolderExist(string InputFolderName)
    string retStatus = false.ToString();
    try
    ClientContext context =
    new ClientContext(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryLink"]));
                context.Credentials =
    CredentialCache.DefaultCredentials;
    List list = context.Web.Lists.GetByTitle(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryName"]));
    FieldCollection fields = list.Fields;
    CamlQuery camlQueryForItem =
    new CamlQuery();
                camlQueryForItem.ViewXml =
    string.Format(@"<View  Scope='RecursiveAll'>
    <Query>
                                            <Where>
    <Eq>
    <FieldRef Name='FileDirRef'/>
    <Value Type='Text'>{0}</Value>
                                                </Eq>
    </Where>
    </Query>
                                </View>",
    @"/sites/test/hcl/"
    + InputFolderName);
                Microsoft.SharePoint.Client.ListItemCollection listItems = list.GetItems(camlQueryForItem);
                context.Load(listItems);
                context.ExecuteQuery();
    if (listItems.Count > 0)
                    retStatus =
    true.ToString();
    else
                    retStatus =
    false.ToString();
    catch (Exception ex)
                retStatus =
    "X02";
    return retStatus;
    thanks
    Sundhar 

    Hi Sundhar,
    According to your description, you might want to check the existence of sub folder in a folder of a library using Client Object Model.
    Please take the code demo below for a try, it will check whether there is sub folder in a given folder:
    public static void createSubFolder(string siteUrl, string libName, string folderServerRelativeUrl)
    ClientContext clientContext = new ClientContext(siteUrl);
    List list = clientContext.Web.Lists.GetByTitle(libName);
    CamlQuery camlQuery = new CamlQuery();
    camlQuery.ViewXml =
    @"<View Scope='RecursiveAll'>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name='FSObjType' />
    <Value Type='Integer'>1</Value>
    </Eq>
    </Where>
    </Query>
    </View>";
    //camlQuery.FolderServerRelativeUrl = "/Lib1/folder1";
    camlQuery.FolderServerRelativeUrl = folderServerRelativeUrl;
    ListItemCollection items = list.GetItems(camlQuery);
    clientContext.Load(items);
    clientContext.ExecuteQuery();
    Console.WriteLine(items.Count);
    if (0 == items.Count)
    //create sub folder here
    Best regards
    Patrick Liang
    TechNet Community Support

  • The timer service encountered an exception checking for the upgrade mode registry key. Requested registry access is not allowed.

    Once in a while i get the error
    Event ID 6463
    The timer service encountered an exception checking for the upgrade mode registry key. Requested registry access is not allowed.
    This also happens when i restart the timer service.
    I already cleared the SharePoint cache (xml's) but no success with that.
    Environment is
    SharePoint 2013 SP1 + CU Dec 2014

    This is a brand new SP13 with SP1 installation after binaries installation i also installed Dec 2014 CU and then created the SP farm.
    The Apppool/Timer account is member of WSS_ADMIN_WPG.
    Issue can be reproduced with restarting SharePoint Timer Service.
    Hereby the Process Monitor output. Hence i filtered it on NOT SUCCESS and Path contains the word UPGRADE
    11:37:57,4244851 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\UpgradeLogLevelOverride
    NAME NOT FOUND Length: 144
    11:37:57,6632057 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\v4.0_policy.15.0.Microsoft.Office.Access.Services.Moss.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:57,6632889 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\policy.15.0.Microsoft.Office.Access.Services.Moss.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:57,7140763 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\v4.0_policy.15.0.Microsoft.PerformancePoint.Scorecards.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:57,7141089 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\policy.15.0.Microsoft.PerformancePoint.Scorecards.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:57,7313089 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\v4.0_policy.15.0.Microsoft.SharePoint.Portal.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:57,7313403 OWSTIMER.EXE
    6272 RegOpenKey
    HKLM\SOFTWARE\Microsoft\Fusion\PublisherPolicy\Default\policy.15.0.Microsoft.SharePoint.Portal.Upgrade__71e9bce111e9429c
    NAME NOT FOUND Desired Access: Read
    11:37:59,2026527 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:37:59,2109400 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3534303 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3537846 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3594290 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3597316 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3653094 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144
    11:38:05,3656118 OWSTIMER.EXE
    6272 RegQueryValue
    HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\MS_InternalUse_Only_UpgradeableVersion
    NAME NOT FOUND Length: 144

  • WHILE CREATING PURCHASE REQUISITION,THE AVAILABILITY CHECK FOR THE MATERIAL

    dear Friends,
    our users want to  WHILE CREATING PURCHASE REQUISITION,THE AVAILABILITY CHECK FOR THE MATERIAL SHOULD BE ENABLE,
    at present we maintaing KP in Material Master.  if we activated what will happen?
    please advice.
    with regards,
    Rajesh G

    Hi,
    The availability check is generally used for goods movements(GR,GI,reservation) & not for PRs.
    Regards,
    Vijay

  • I am looking for a way to develop a grammar checker for the web like spellcheckerplus can you help?

    I am looking for a way to develop a grammar checker for the web like spellcheckerplus can you help? I have my own dictionary for comparing and replacing words.

    Hi,
    The forum is about install/uninstall .NET Framework, please post your issue to dev related forum instead of here.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Checking for the existence of a Frame

    Hello,
    I am currently designing an application which consists of 8 JFrames (all in different classes), During the application, one JFrame provides information to a user and when they select the appropriate fields another JFrame opens an the active one closes. However the problem i am having is that i need to be able to write an if statement saying
    if (this particular frame exists already){
    destroy it;
    }else{
    whatever........};
    But i dont know how to check for the existence of a frame currently running, or how to destroy it..
    im currently using dispose(); to destroy frames but the dispose method only works when your in the class thats creating the frame, it wont let me write something like class1.dispose() (where class1 is the frame object created in the constructor of class1.java); in class2.
    I have searched throught the forum and havent found anything that can help me, i would really appreciate anyones input.
    Thanks in advance,
    Dev

    Hey its ok i've decided to restructure the program, but if anyone does know how to do this please still reply to the message, as i would still like to know

  • I am on a MAC Application. It has  been rejected by following reason.  This app does not check for the existence of a purchase receipt, which can prevent In-App Purchases from being correctly processed. We recommend implementing receipt validation to reso

    I am on a MAC Application.
    It has  been rejected by following reason.
    This app does not check for the existence of a purchase receipt, which can prevent In-App Purchases from being correctly processed.
    We recommend implementing receipt validation to resolve this issue.
    At a minimum, the app will need to check for the existence of an App Store receipt and exit at launch with a status of 173 if it does not exist.
    Any help ?
    Thanks in Advance.

    I am on a MAC Application.
    It has  been rejected by following reason.
    This app does not check for the existence of a purchase receipt, which can prevent In-App Purchases from being correctly processed.
    We recommend implementing receipt validation to resolve this issue.
    At a minimum, the app will need to check for the existence of an App Store receipt and exit at launch with a status of 173 if it does not exist.
    Any help ?
    Thanks in Advance.

  • Where to Authorization check for the plant while creating outbound delivery

    Hi Experts,
    For outbound delivery , the standard program is not doing the authorization check .
    Can i use BADI       *LE_SHP_DELIVERY_PROC *        and the method :     DELIVERY_FINAL_CHECK
    To write Authority-check statement ,
    If the particular is not authorized for any of the plants of the items in the outbound delivery i will throw a error message
    Can i use as above?
    And if i use it has to apply only for outbound delivery?Because for inbound delivery also the same BADI is getting triggered?
    Please suggest.
    Regards
    Ramakrishna L

    Hi,
    Yes you can use the said BAdi and the method if it is triggerd before the SAVE of the Outbound Delivery Order to do the Authorisation Check. In case the code is triggered for all the orders and you want only to restrict for the Outbound Delivery, then check for the Delivery Type (LFART) from the Delivery Header table for only the Outbound Delivery Order.
    Thanks,
    Susanth Swain

Maybe you are looking for

  • Any way to use cursor values inside other cursor by bulk collect?

    hi, Is there any way to use cursor get_tables value insdide loop get column if i am using bulk collect in both cursors? I tried a lot but i am nt able to do it.kindly help... create or replace procedure MULTIPLE_CURSORS_PROC is v_owner varchar2(40);

  • Midi notes or audio region do not play at the start of a bar?

    I am having an issue with a midi loop I have created. If I let the song play a bit until it reaches the loop, logic works just as you'd expect it and everything plays correctly. But if I stop the song, or if I set the song into cycle mode so it repea

  • SAP Gui on Windows Vista

    Hi, I am getting a Dump error while logging in to the SAP GUI 7.10( After Giving user name and Password) in Windows vista( Business 32 Bit OS). Error log as follows, Could anyone pls give me solution. Information on where terminated                  

  • Compilation error when deploying EAR file on standalone OC4J...

    Hi All, I am getting the following error when trying to deploy an EAR File describing a web service from the Jdeveloper IDE to the stanalone OC4J server instance. ========================================================== Uploading file JavaWebServic

  • Decision Pop Up: buttons with custom message

    Hi Experts, I have a requirement to display buttons with custom message on it for a decision pop up instead of 'Yes' or 'No'. Please guide me how do I do it? Thanks for your help. Regards, Surekha.