how can i write the java program with wildcard like "%" "_"

Discussion in 'Java' started by alicecuee@gmail.com, Oct 9, 2005.

  1. Guest

    Dear All,
    I would like to write a java program with user input string with
    regular express like "%" and "-" and query it in SQL.

    How can i write the program with string support that kinds of wildcard?

    Thanks
     
    , Oct 9, 2005
    #1
    1. Advertising

  2. Roedy Green Guest

    On 8 Oct 2005 21:46:38 -0700, wrote or quoted :

    >How can i write the program with string support that kinds of wildcard?


    See http://mindprod.com/jgloss/main.html

    about passing awkward characters through the command line.

    You might choose a character that does not already have meaning to the
    command processor e.g. ~

    SQL has the LIKE % feature. All you have to do is compose a suitable
    query.

    If you want to find files yourself that match some wildcard criteria,
    you need to learn about FilenameFilters, File, File.list,
    File.isDirectory.

    See http://mindprod.com/jgloss/file.html

    You might be interested in my RegexFilter. See
    http://mindprod.com/products1.html#FILTER

    With it you configure the filter with a regex describing the files you
    want.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Oct 9, 2005
    #2
    1. Advertising

  3. <> wrote in message
    news:...
    > Dear All,
    > I would like to write a java program with user input string with
    > regular express like "%" and "-" and query it in SQL.
    >
    > How can i write the program with string support that kinds of wildcard?


    If you mean that you want your program to do matches with SQL-like
    wildcards, the simplest thing will be to translate them into regexp-style
    wildcards.
     
    Mike Schilling, Oct 9, 2005
    #3
  4. Alan Krueger Guest

    wrote:
    > I would like to write a java program with user input string with
    > regular express like "%" and "-" and query it in SQL.


    Perhaps you should describe exactly what these characters should mean.
    I'm familiar with "%" in SQL, but have no idea what "-" should mean.

    If you're going to query those in SQL, do you want to mimic this
    behavior in Java or do you want to use the behavior implemented by your
    SQL database? The approach to these would be very different.
     
    Alan Krueger, Oct 10, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page