Help constructing a simple RegEx search?

Discussion in 'Programming' started by sunnymonkey, Jan 29, 2008.

  1. #1
    Hey all. I have a directory of text files that contain lists of domain names.

    I need to run a search on that directory to find all domains of 5 characters in length followed by .com

    examples:

    12345.com
    abcde.com

    I need the regex formula to find
    5_of_any_number_or_letter.com

    Any help would be fab!
     
    sunnymonkey, Jan 29, 2008 IP
  2. awatson

    awatson Active Member

    Messages:
    112
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    The pattern would be "\w\w\w\w\w\.com"
     
    awatson, Jan 29, 2008 IP
  3. krzyk

    krzyk Peon

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    probably better is [A-Za-z0-9]{5}\.com

    as the \w character also includes underscore (which does not match with 5_of_any_number_or_letter.com)
     
    krzyk, Jan 29, 2008 IP