Ok, i got this so far ...

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Testing2 {

    public static void main(String[] args) {
        Pattern p = Pattern.compile("[wati]");
        String text = "water";
        Matcher m = p.matcher(text);
        if (m.find()) {
            System.out.print("Found !");
        }
    }
}

With that code i got a match, but i ONLY want to find a match if the String matches the EXACTS characters in the Pattern ...

in this case i got, 'w' 'a' 't' 'i', 'w' 'a' 't', are in water, but 'i' NOT, so i don't want to have a match !

i don't know how to acomplish this :(

hope you can help me, thanks in advance :D

Do you want to match the String "wati", or do you want to match a String that contains a w or an a or a t or an i (which is what your pattern says now)? Or do you want to match a String that contains all of those characters regardless of order or amount?

thanks for your answer !!

i want to match a String that contains all of those characters regardless of order or amount BUT if a character is not in the string it should be NO matches ...

for example :

t match "water"
ret match "water"
retaw match "water"
wret match "water"
BUT
'i' DOESNT match "water" because 'i' is not in the string "water"
watzer DOESNT match "water" because 'z' is not in the string "water"

that is how the regex should work for what i need ...

is kinda hard to explain, hope you understand, and thanks again.

I have now given you a full answer on Sun's forums.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.