Search:

Type: Posts; User: Sean4u

Search: Search took 0.10 seconds.

  1. Replies
    31
    Views
    3,482

    Re: Splitting text into several components

    I have already explained how to make a TreeMap sort in reverse Integer order. Read the API doc for TreeMap, use the constructor with the Comparator in it and write a Comparator that does what you...
  2. Replies
    31
    Views
    3,482

    Re: Splitting text into several components

    Oh really? I only tested it on the regex test site, so it could be that it works slightly differently for you - although perhaps the test site detects the first zero-length find and stops at that...
  3. Replies
    31
    Views
    3,482

    Re: Splitting text into several components

    A couple of minutes' fiddling at the test site got me this pattern:

    \+{0,1}(\-{0,1}[0-9]{0,})x{0,1}(\^[0-9]{0,}){0,1}
    which produces one extra match with both groups empty. Remember to double-up...
  4. Replies
    31
    Views
    3,482

    Re: Splitting text into several components

    Seems like you're doing just fine. You're right - a reasonable pattern for something like you're doing could be (not tested by compiling)
    Matcher matcher = PATTERN_POLY.matcher(inputString);
    if...
  5. Replies
    31
    Views
    3,482

    Re: Splitting text into several components

    Use java.util.regex.Pattern - it takes a while to learn how to use regular expressions properly, but they should be in every programmers' toolbox.

    Test your regexes here:
    RegEx: online regular...
Results 1 to 5 of 5