0

Why this regex isnt working for non-word and non-digits like this: )(ª º ?

sentence.split("[^(\\p{L}\\p{N})]");

Is it suposed to work or not?

PS: I can't find any information either on SOF or in the web

3
  • 1
    Can you explain in more detail what you want to happen? Perhaps give example input with expected and observed output? Commented Oct 2, 2011 at 10:55
  • What's in the sentence variable, and what's your expected output? Commented Oct 2, 2011 at 10:55
  • i checked the words after the split, and there are words like this: "(wordA", "word(d", "wordº", "wordªª", and shouldnt. I think that expression will exclude this cases. In that case, how can i add "(", ")", "º", and "ª" to that regex? Commented Oct 2, 2011 at 11:02

1 Answer 1

2

A better description of the problem would be nice, but I'm guessing you're looking for:

sentence.split("\\W+");
Sign up to request clarification or add additional context in comments.

1 Comment

it workds. Thank you very much, i firstly used this pattern and was not working.

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.