in reply to file$name.class find - regexp ?

In one of your examples, '$' replaces a character in 'testfile'; in two others, '$' is just put in between 'testfile'. And in one example, 'class' becomes 'call'.

If it were just a '$' put in, it would be easy: for each file in the directory, remove the '$' from the name (if any), then check if the result equals 'testfile.class'.

But such an approach would fail 2 out of your 3 examples.

Replies are listed 'Best First'.
Re^2: file$name.class find - regexp ?
by dani_cv (Acolyte) on Sep 27, 2008 at 01:04 UTC
    Thanks for your reply...sorry it should be class.
    But I guess my question is I know the base file name 'testfile.class'. I need to find if there are any other files exists in the directory with a $ sign in between of testfile.class. $ can come anywhere...
    like, I know testfile.class and I want to any related files like test$file.class or testfi$le.class exists in the same directory...
    Thanks bunch..
      As I said, look at each file in the directory. If it contains a '$', remove it. If the result equals 'testfile.class', the original was 'testfile.class' with a '$' somewhere in it.
      You still haven't answered JavaFan's original question: will the '?' character be inserted into the string, leaving all the other characters and simply changing some of their offsets in the string, or may the '?' replace one of the other characters in the string, or both?

      In the first case, the answer is fairly straightforward, and JavaFan has given it to you. In the other cases, the problem is a bit more complex.

      Can you please be more specific about your exact problem?