9 Replies Latest reply: Nov 14, 2009 5:57 AM by 800308 RSS

    Regex code to include words but not numbers

    794113
      Hi,

      I wanted to find all the words in a file but not the numbers or digits.

      I am using this line of code but not getting the ideal results.
      Pattern p = Pattern.compile("[\\w']+[\\D]",Pattern.MULTILINE);
      Again, I dont want the numbers. Without the numbers part the code is giving me the words with the numbers ie if I dont use the [\\D] part.

      This is working fine: ie gives the words with the digits:
      Pattern p = Pattern.compile("[\\w']+",Pattern.MULTILINE);
      Thanks,