How to make a regular expression case insensitive?

Hi,
I am using SAP UI5 .
I am validating the user input using a regular expression to make sure user dose not enter a keyword which is reserved.
var regexAppID = /^(?=^(?:(?!(^Admin$|^AdminData$|^Push$|^smp_cloud$|^resource$|^test-resources$|^resources$|^Scheduler$|^odata$|^applications$|^Connections$|^public|^Public$|[\.]{2,}|^[\.])).)*$)(?=^[a-zA-Z]+[a-zA-Z0-9_\.]*$).*$/;
textField.mBindingInfos.value.type.oConstraints.search = regexAppID;
The regex blocks the user from entering the keywords Admin,AdminData etc.
It works fine if the user enters the value as it is given in regex (ie case sensitive example "Admin").
But when user enters "admin" or "aDmin" etc the regex is not catching it and my server crashes as it bypasses these keywords.

Can't you use this expression?
^/(?!ignoreme$)(?!ignoreme2$)[a-z0-9]+$
Then you will have only a match when the word is something else then "ignoreme" or "ignorme2".
Why don't you just check it in an IF statement? if(input==="ignoreme" or ... ) ? It's both static.. or you could put all options in an array and use the statement indexOf to find if it is in the array.
JavaScript Array indexOf() Method
Kind regards,
Wouter

Similar Messages

  • How to make MySQL JDBC Driver case-insensitive

    Hi,
    I'm porting a jdbc application from oracle to mysql. One of the problem is that oracle's column names are case insensitive, whereas CODE in mySql is different from code (see example posted below).
    I know that I can change the source code to use always the same case. But is there a way to make the mysql jdbc driver case-insensitive ?
    import java.sql.*;
    /* getString(String) is case sensitive for org.gjt.mm.mysql.Driver driver */
    mysql> describe currency;
    +-----------------+----------------+------+-----+----------------+-------+
    | Field           | Type           | Null | Key | Default        | Extra |
    +-----------------+----------------+------+-----+----------------+-------+
    | code            | char(3)        |      | PRI |                |       |
    | name            | varchar(40)    |      | UNI |                |       |
    | shortCode       | char(2)        | YES  | MUL | NULL           |       |
    | exchangeRate    | decimal(19,12) |      |     | 0.000000000000 |       |
    | changed         | decimal(1,0)   |      |     | 0              |       |
    | markedFlag      | decimal(1,0)   |      |     | 0              |       |
    | updateTimestamp | timestamp(14)  | YES  |     | NULL           |       |
    +-----------------+----------------+------+-----+----------------+-------+
    7 rows in set (0.00 sec)
    getObject(1)=EUR
    Trying code
    getObject("code")=EUR
    Trying Code
    java.sql.SQLException: Column 'Code' not found.
         at org.gjt.mm.mysql.ResultSet.findColumn(ResultSet.java:1213)
         at org.gjt.mm.mysql.ResultSet.getObject(ResultSet.java:1188)
         at mySqlDemo.main(mySqlDemo.java:61)
    getObject(1)=USD
    Trying code
    getObject("code")=USD
    Trying Code
    java.sql.SQLException: Column 'Code' not found.
         at org.gjt.mm.mysql.ResultSet.findColumn(ResultSet.java:1213)
         at org.gjt.mm.mysql.ResultSet.getObject(ResultSet.java:1188)
         at mySqlDemo.main(mySqlDemo.java:61)
    public class mySqlDemo {
         public final static void main(String[] args) {
              try {
                   /*== database constants ==*/
                   String DBHOST = "localhost";
                   String DBNAME = "test";
                   String DBUSER = "test";
                   String DBPASS = "";
                   String DBDRIVER = "org.gjt.mm.mysql.Driver";
                   /*== setup database driver and connect ==*/
                   Class.forName(DBDRIVER).newInstance();
                   String conurl = "jdbc:mysql://"+DBHOST+"/"+DBNAME;
                   Connection db = DriverManager.getConnection(conurl,DBUSER,DBPASS);
                   /*== create sql query and execute ==*/
                   //String sql = "select code from currency";
                   String sql = "select Currency.code, Currency.name, Currency.shortCode, Currency.exchangeRate, Currency.changed, Currency.markedFlag, Currency.updateTimestamp from Currency order by code";
                   Statement stmnt = db.createStatement();
                   ResultSet rs = stmnt.executeQuery(sql);
                   /*== display results ==*/
                   while(rs.next()) {
                          System.out.println("getObject(1)=" + rs.getObject(1));
                          // works, because "Currency.code" has been selected
                          System.out.println("Trying code");
                          try {
                                 System.out.println("getObject(\"code\")=" + rs.getObject("code"));
                          } catch(SQLException ex) {
                               ex.printStackTrace();
                         // case sensitive !
                          // does not work, because "Currency.code" has been selected
                          // "code" != "Code"
                          System.out.println("Trying Code");
                          try {
                                 System.out.println("getObject(\"Code\")=" + rs.getObject("Code"));
                          } catch(SQLException ex) {
                               ex.printStackTrace();
              } catch(Throwable t) {
                   t.printStackTrace();
    }

    One of the problem is that oracle's column names are
    case insensitive, whereas CODE in mySql is different from code (see example posted below).I doubt that.
    SQL standards are rather specific that columns names are case insensitive unless quoted identifiers are used. And presumably you are doing that.
    What you are seeing is a difference in drivers not databases.
    I would guess that the only way to change the behaviour is to modify your code. If you uppercase everything it should work. Or you could use positional rather than named column extraction.

  • How to write the regular expression for Square brackets?

    Hi,
    I want regular expression for the [] ‘Square brackets’.
    I have tried to insert in the below code but the expression not validate the [] square brackets.
    If anyone knows please help me how to write the regular expression for ‘[]’ Square brackets.
    private static final Pattern DESC_PATTERN = Pattern.compile("({1}[a-zA-Z])" +"([a-zA-Z0-9\\s.,_():}{/&#-]+)$");Thanks
    Raghav

    Since square brackets are meta characters in regex they need to be escaped when they need to be used as regular characters so prefix them with \\ (the escape character).

  • Is there a way to make the "Find" feature case insensitive?

    Is there a way to make the "Find" feature case insensitive?

    ''Is there a way to make the "Find" feature case insensitive?''
    Find ("Ctrl+F")
    :uncheck "Match case" on the Find bar
    An extension that enhances the Find bar for something they have not added is
    *Find All :: Add-ons for Firefox
    *:https://addons.mozilla.org/en-US/firefox/addon/find-all/
    And if you want a serious fixup for Find see/vote [https://bugzilla.mozilla.org/show_bug.cgi?id=171237 Bug 171237] even though it still misses the point, it should be "exactly" like Opera.

  • Trying to enter hotel password and 1st letter is always upper case and password is lower case.  Can't figure out how to make 1st letter lower case

    I am trying to enter a hotel password for internet access.  The password is all lower case, but the 1st letter I type is always upper case and I can't figure out how to make it lower case.  Help?

    The digital keyboard on the iPad uses an "Up Arrow" as a symbol to represent its shift key(s). If it's highlighted, then the next letter typed will be upper-case. Just tap on the Arrow symbol and it should be unhighlighted. Now if you type any letter, it will be lower-case.

  • How to form a regular expression for matching the xml tag?

    hi i wanted to find the and match the xml tag for that i required to write the regex.
    for exmple i have a string[] str={"<data>abc</data>"};
    i want this string has to be splitted like this <data>, abc and </data>. so that i can read the splitted string value.
    the above is for a small excercise but the tagname and value can be of combination of chars/digits/spl symbols like wise.
    so please help me to write the regular expression for the above requirement

    your suggestion is most appreciable if u can give the startup like how to do this. which parser is to be used and stuff like that

  • How to define a regular expression using  regular expressions

    Hi,
    I am looking for some regular expression pattern which will identify a regular expression.
    Also, is it possible to know how does the compile method of Pattern class in java.util.regex package work when it is given a String containing a regex. ie. is there any mechanism to validate regular expression using regular expression pattern.
    Regards,
    Abhisek

    I am looking for some regular expression pattern which will identify a regular
    expression. Also, is it possible to know how does the compile method of
    Pattern class in java.util.regex package work when it is given a String
    containing a regex. ie. is there any mechanism to validate regular
    expression using regular expression pattern.It is impossble to recognize an (in)valid regular expression string using a
    regular expression. Google for 'pumping lemma' for a formal proof.
    kind regards,
    Jos

  • How to search with regular expression

    I make pdx files so that I can search text quickly. But Acrobat doesn't provide a way to search with regular expression. I'm wondering if there is a way that I don't know to search for regular expression in Acrobat Pro 9?

    First, Acrobat must "mount" the PDX.
    As "Find" does not use the cataloged index, use Shift+Ctrl+F to open the advanced search dialog.
    It may be helpful to first enter Acrobat Preferences and for the Search category tick "Always use advanced search options".
    Back to the Search dialog - use the drop down menu for "Look In" to pick "Select Index" then, if no PDXs show, click the Add button.
    In the Open Index File dialog, browse to the location of the desired PDX and select it.
    OK out and use "Return results containing" to pick a "Match ..." requirement or Boolean.
    To become familiar with query syntax, for Acrobat, it is good to review Acrobat Help.
    http://help.adobe.com/en_US/Acrobat/9.0/Professional/WS58a04a822e3e50102bd615109794195ff-7 c4b.w.html
    Be well...

  • How to change Database server is case-insensitive setting at runtime

    Is there a way to change any of the properties in Report Options > General Settings at runtime. Mainly the [Database server is case-insensitive] and [Perform grouping on server] settings. We are using the Crystal .Net X1 runtimes (11.5.9707.811). I have sesrched the forums with no luck so thought I'd try my luck here. Thankyou for your time.

    Hi Simon,
    Sorry, search for the function using the Object Browser in .NET. If you have Crsytal Reports XI R2 (11.5.x.xxxx) then you have it. Unless it's not a developer version. In whcih case you need to upgrade.
    If you do have the Developer version then simply add the RAS assemblies to your project. Look in our samples above for more info on h ow to use RAS.
    If you don't have the Developer version then your only options are to upgrade or manually change the report settings in the Designer.
    Thank you
    Don

  • How can I use regular expression to match this rule

    I have a String ,value is "<a>1</a><a>2</a><a>3</a>",and want to match other String like "<a>1</a><a>8</a>",if the one of the first string(like "<a>1</a>") will occur in the second string,then will return true.but I don't know how to write the regular expresstion.
    Thx

    Fine fine. :P
    I was a little bored, so here's some code that uses Strings and a StringBuffer (though you could use a String in place of the StringBuffer). Is this perhaps better? :)
              String testMain = "<a>1</a><ab>2</ab><ab>3</ab>";
              String test = "<ab>1</ab><ab>3</ab>";
              String open = "<ab>";
              String close = "</ab>";
              StringBuffer search = new StringBuffer();
              String checkString = null;
              int lastCheck = 0;
              int start = 0;
              int finish = 0;
              boolean done = false;
              while (!done) {
                   start = test.indexOf(open);
                   finish = test.indexOf(close);
                   if ((start == -1) || (finish == -1)) {
                        System.out.println("No more tags to search for.");
                        done = true;
                   else {
                        checkString = test.substring((start + open.length()), finish);
                        search = new StringBuffer();
                        search.append(open);
                        search.append(checkString);
                        search.append(close);
                        if (testMain.indexOf(search.toString()) != -1) {
                             System.out.println("Found value: " + checkString);
                        test = test.substring(finish + close.length());
    Resulting output:
    Found value: 3
    No more tags to search for.
    -G

  • How to compare string in a case-insensitive manner using JavaScript?

    Hello everyone,
    Now I have a javascript to compare checkbox's value with user's input, but now seems it only can compare case-sensitively, does some one know if there is a function in javascript that it can compare string case-insensitively ?
    Here is my script :
    function findOffice(field)
    var name;
    name=prompt("What is the office name?");
    var l = field.length;
    for(var i = 0; i < l; i++)
    if(field.value==name)
    field[i].checked=true;
    field[i].focus();
    field[i].select();
    break;
    <input type="button" name="Find" value="Find And Select" onClick="findOffice(form1) >
    Thanks in advance !
    Rachel

    Thank you so much, I already solved the problem with your advice.
    You really have a beautiful mind, :-).
    I appreciate your help !
    Rachel

  • How can I add Regular Expression verify?

    I need to write a Regular Expression for date whose format is 'yyyy-mm-dd'('2004-5-3' or '2004-05-03') and a Regular Expression for phone number whoes format is '12345678' or '1234567' or '13809441234'.
    Thanks for any help.

    The date format is a little tricky as there are many invalid combinations. You'd be better off calling TO_DATE with your user input and format mask. If an error is returned, the date is invalid.
    For the phone number assuming a valid phone number could be 7, 8, or 11 digits (it's a little difficult to tell what the format your suggest is) then you could apply something like the following:
    ^[0-9]{7}([0-9]|[0-9]{4})?$
    Regards.

  • How do I make my hard drive case insensitive?

    I have recently tried to purchase Adobe Acrobat XI, an upgrade from Acrobat Pro 9, which ran just fine on my MacBook Pro. When I try to install XI, I get the following message: "The installation cannot proceed, because the operating system is running on a case sensitive volume."
    How can I resolve this issue so I can run Acrobat XI on my MacBook Pro?

    You can't without backing up your drive, and making your HD NON mac osx case sensitive file system and moving all data back onto your drive
    http://superuser.com/questions/380330/mac-convert-from-case-sensitive-to-case-in sensitive-file-system
    You could also make a small partition that is not case sensitive and install it from there

  • How to make dynamic selection in case of innerjoin

    hi
    in run time i will get some table name into g_v_fubw
    if i write a select quiry like this its working
      SELECT * FROM (g_v_fubw)
        INTO TABLE g_it_fubw
        FOR ALL ENTRIES IN g_it_werks
        WHERE kostl IN s_kostl3    AND
              platznr IN s_platz3  AND
              werks = g_it_werks-werks   AND
              matnr IN s_matnr     AND
              prctr IN s_prctr.
    But if i am  using inner join  like bellow
        SELECT
        avalev ainvpe vastrd vtxjhr a~bukrs
        awerks amatnr
        aindei abwtar a~bklas
        v~adqty
        v~meins
        a~peinh
        INTO TABLE g_it_temp_display
                FROM (g_v_fuba) AS a INNER JOIN
                     (g_v_abcd) AS v ON
                       amatnr = vmatnr AND
                       ainvpe = vinvpe
              WHERE a~invpe EQ p_invw                 AND
                    a~valev EQ 'P'              AND
                    v~astrd IN g_r_astrd              AND
                    v~txjhr IN g_r_txjhr              AND
                    a~bukrs EQ p_bukrs                AND
    its not working
    how can i write dynamic select quiry using innerjoin

    Hi...
    Make sure the structure of g_it_temp_display is same as the selected fields.
    FROM (g_v_fuba AS a INNER JOIN
    g_v_abcd AS v ON
    amatnr = vmatnr AND
    ainvpe = vinvpe ).....>
    See the syntax...
    as below...
    SELECT a~knuma_ag          "SAP agreement number
           a~boart_ag              "SAP agreement type
           a~zzlegsum              "Legacy summary number
           b~datab                 "Begin date
           b~datbi                 "End date
      FROM ( /irm/ipbbasp AS a INNER JOIN  kona AS b ON
      aknuma_ag = bknuma )
      INTO TABLE i_irm_kona
      FOR ALL ENTRIES  IN i_kona_deal
      WHERE a~boart_ag IN r_agrmnt_typ  AND         "SAP agreement type
            a~zzlegsum IN r_summ_number AND         "Legacy summary number
            b~knuma = i_kona_deal-knuma AND         "SAP agreement No
            b~valdt    IN r_ppd.                "Prior price date

  • How to make a number lower case?

    Write a program to convert uppercase numbers to lowercase numbers. You may use any part of the Java API but may not team together with other students and turn in group work. You must write the class and provide at least 5 methods but no more than 8 methods to accomplish this task. Your program must be able to accept arguments from the command line
    public class MakeLowerCaseNumber
    public MakeLowerCaseNumber(String[] args)
    int i;
    for (i =0; i < args.length; i++)
    makeLower(args);
    private void makeLower(String argument)
    System.out.print("Making " + argument + " into a lowercase number ");
    public static void main(String[] args)
    MakeLowerCaseNumber makeLowerCaseNumber = new MakeLowerCaseNumber(args);
    I am lost. I have written this much. It doesn't make my number lowercase. Can someone show me what to do?

    You make a lower case number by adding the difference
    return lowerChar +('a' - 'A');
    So try doing the same for a number.That's one way. Since this is such a stupid assignment, I have a couple other suggestions:
    For every number (which could be interpreted as each individual digit or each string of +/-, digits, and at most one decimal point, or even include scientific notation)...
    1) ...just change that number to the string "lowercase numbers."
    2) ...change the numbers to their spelled out equivalents (in lowercase, of course), e.g. "three", "forty-two"
    3) ...since the assignment said, "convert uppercase numbers to lowercase numbers," you could interpret it as "If the number is uppercase, convert it to lowercase," and then start your processing code with Character.isUperCase(), which will return false every time.
    4) ...as a variation on #3, just call to CharacterLowerCase() on each digit.
    <editorial>
    I hate teachers who think they're being clever and teaching students to "think outside the box" when they come up with nonsensical problems like this. They need a good smiting.
    </editorial>

Maybe you are looking for

  • Adding data into a custom table through a report transaction

    Is it possible to add data into a table through a report transaction. I have been asked to create a report in which when we add certain data in the selkection screen it updates thoses particular fields and the rest of the records can be fille dout in

  • Error Message on iMessage log in

    iMessage is angering me to the point of no return on my ipod. So iMessage was working just fine and then I tried to use Facetime and it was signed out. I tried to sign back in and I get a message saying "An error occurred during activation. Try again

  • Itunes won't recognize Ipod Classic after update

    I updated my Itunes to the most recent version, then when I plugged my Ipod Classic 120gb in, Itunes would not recognize it and erased everything off of it. When I try to sync it the ipod freezes as well as Itunes and I have to unplug it and restart

  • What is the best way to take care of the battery?

    What is the best way to charge and use the battery so it lasts the longest over time? Does wall charger versus USB make a difference? Does topping off versus draining make a difference? Thanks!

  • Resource injection in DAO?

    I use a Data Acces Object pattern in a Java EE 5 Web-Tier Application. The servlets (and JSP) in the front-end call a separate object that that hides the implementation of accessing data in the databases and maintains the connection to databases. Can