Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > regular expression all string but not '.dwg'

Reply
Thread Tools

regular expression all string but not '.dwg'

 
 
xlstatik
Guest
Posts: n/a
 
      06-09-2006
Hallo,

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

 
Reply With Quote
 
 
 
 
Oliver Wong
Guest
Posts: n/a
 
      06-09-2006

"xlstatik" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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

 
Reply With Quote
 
 
 
 
shakah
Guest
Posts: n/a
 
      06-09-2006

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])$"

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Regular Expression to extract all numbers from a string to a group collection Jay Douglas ASP .Net 3 08-27-2004 08:51 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments