regular expression all string but not '.dwg'

Discussion in 'Java' started by xlstatik, Jun 9, 2006.

  1. xlstatik

    xlstatik Guest

    Hallo,

    ist ist possible to search with regexp for all extensions wihtout the
    single exception '.dwg'?
    Who would this regular expression look like?
    xlstatik, Jun 9, 2006
    #1
    1. Advertising

  2. xlstatik

    Oliver Wong Guest

    "xlstatik" <> wrote in message
    news:...
    > Hallo,
    >
    > ist ist possible to search with regexp for all extensions wihtout the
    > single exception '.dwg'?
    > Who would this regular expression look like?
    >


    Technically, a regular expression will either accept a given input
    string, or reject it. It does not do searching in and of itself.

    When searching with a regular expression is done, what usually happens
    is that a whole bunch of substrings of the so-called "haystack string" are
    passed over to the regular expression, and the longest such substring is
    returned as the so-called "needle string". The details in the implementation
    will alter the behaviour of the program. So for example, you could say "Give
    me all non-overlapping substrings of parameter1 which do not contain
    '.dwg'", and then pass ".dwg" as parameter1, and the search engine will
    return two substrings: {".dw", "g"}, both fo which don't contain ".dwg".

    In other words, you'll have to be more specific in your description of
    what you want. Do any of these boolean expressions do what you want?

    !inputString.endsWith(".dwg")
    !inputString.contains(".dwg")
    !inputString.equals(".dwg")

    - Oliver
    Oliver Wong, Jun 9, 2006
    #2
    1. Advertising

  3. xlstatik

    shakah Guest

    xlstatik wrote:
    > Hallo,
    >
    > ist ist possible to search with regexp for all extensions wihtout the
    > single exception '.dwg'?
    > Who would this regular expression look like?


    If all the things you are comparing have extensions, and they are all
    three letters, something like the following might work for you:
    "^.*\.([^d]..|.[^w].|..[^g])$"
    shakah, Jun 9, 2006
    #3
    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.
Similar Threads
  1. VSK
    Replies:
    2
    Views:
    2,267
  2. Jay Douglas
    Replies:
    3
    Views:
    3,491
    Jay Douglas
    Aug 27, 2004
  3. Packy
    Replies:
    0
    Views:
    535
    Packy
    Oct 15, 2003
  4. james

    DWG API

    james, Jan 16, 2004, in forum: Java
    Replies:
    1
    Views:
    4,209
  5. Deepa

    Cannot find DWG files

    Deepa, Mar 1, 2004, in forum: ASP General
    Replies:
    7
    Views:
    206
    Mark Schupp
    Mar 1, 2004
Loading...

Share This Page