0

In the below string I'm supposed to read the value from ` (opening single quote - ASCII value 96) until . I couldn't figure out how to come up with a regex for this case - errors due to alphanumeric and numeric conditions. Please HELP!

nonworking string

Actual string:

str="00└9a00└9g00└9`000└9a00└9e000└9a00└9`000└9a00└9e000└9a00└9`000└9a00└9e000└9a00└9`000└9a";

Data to be read: between ` and .

3
  • 2
    Please update your question with the actual string you are trying to parse. Commented Dec 28, 2011 at 19:54
  • updated with the actual string cheers Commented Dec 28, 2011 at 20:13
  • That first character is not a single-quote (or apostrophe), it's a grave accent. I fixed the formatting so you can see it more clearly. The other one appears to be U+2514, one of the box-drawing characters. Commented Dec 29, 2011 at 3:32

2 Answers 2

1

Would this work? The captured string should be what you want.

Pattern p = pattern.compile("'([^└]*)└"); // ('[^└]*└) if you want the ' and └ too
Sign up to request clarification or add additional context in comments.

3 Comments

Those are probably not square brackets in his string. They are some funky characters that the GUI does not know how to display.
I figured as much, but I didn't know what else to use to represent what he wanted to match.
those are not square brackets sorry. When I did a printing on screen, i received this └. It would be great if the pattern is with java syntax. Pattern p = pattern.compile(regex);
0

Maybe

Pattern.compile("`(\\p{Print}++)")
and capture $1?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.