#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    [regex] select word of 3 letter


    hi

    i search a way to detect all word who have more then 3 letters

    thanks
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0
    maybe that could work (?=\\b\\w{4,}\b)
  4. #3
  5. Turn left at the third duck
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Location
    Nelson, NZ
    Posts
    112
    Rep Power
    93
    Hi marcpirat,

    This expression should work with Java-flavor regex:
    Code:
    \b[a-zA-Z]{3,}\b
    I don't program in Java, but here's a code snippet generated by RB and using this expression:

    Code:
    try {
    	Pattern regex = Pattern.compile("\\b[a-zA-Z]{3,}\\b");
    	Matcher regexMatcher = regex.matcher(subjectString);
    	while (regexMatcher.find()) {
    		// matched text: regexMatcher.group()
    		// match start: regexMatcher.start()
    		// match end: regexMatcher.end()
    	} 
    } catch (PatternSyntaxException ex) {
    	// Syntax error in the regular expression
    }

IMN logo majestic logo threadwatch logo seochat tools logo