Closed Thread
Results 1 to 5 of 5

Thread: regular expression

  1. #1
    prof.deedee is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Sheffield in UK
    Posts
    50
    Rep Power
    0

    regular expression

    Hi

    This time I don't know how to write regular expression to match :

    String sql = "select * from user where username='" + username +"' and password='" + password + "'";

    what I want exactly is:
    1- match word select (ignore cases).
    2-if that line match then save the variable name(which sql in my example above) save it in String test.
    3-make another regular expression to match test (from step 2) into any other line.

    Thanks

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    R3.RyozKidz Guest

    Re: regular expression

    u can use compareToIgnoreCase() which is one of the method in String class
    u can compare the username like this :
    Code:
    username.compareToIgnoreCase("whatever you want to compare");
    Is your match word select is to select word from the string sql ??

  4. #3
    prof.deedee is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Sheffield in UK
    Posts
    50
    Rep Power
    0

    Re: regular expression

    what I mean is : I want regular expression to match any string that have word(select)
    and then if this string matched, save this string name (mg)in variable for example (xxx).

    after that make another regular expression to match that string name (mg) which we save it in xxx with any other string containing that name (mg)

  5. #4
    chirag.jain18 is offline Newbie
    Join Date
    Oct 2009
    Posts
    10
    Rep Power
    0

    Re: regular expression

    use indexOf(String s) method of String class.

  6. #5
    prof.deedee is offline Learning Programmer
    Join Date
    Apr 2009
    Location
    Sheffield in UK
    Posts
    50
    Rep Power
    0

    Re: regular expression

    Thank you

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Regular expression preg_match_all
    By MarkuesSchoen in forum PHP Development
    Replies: 1
    Last Post: 08-03-2011, 03:54 PM
  2. Require help with Regular Expression.
    By BotMaster in forum C# Programming
    Replies: 2
    Last Post: 03-17-2011, 09:13 AM
  3. Regular expression questions
    By onething in forum General Programming
    Replies: 4
    Last Post: 02-19-2011, 05:49 PM
  4. help with regular expression
    By Orjan in forum PHP Development
    Replies: 2
    Last Post: 03-14-2009, 09:51 AM
  5. c# regular expression
    By moonrise in forum C# Programming
    Replies: 3
    Last Post: 05-22-2006, 02:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts