PCRE and Whitespace
Using PCRE lib...wanting to look for a string of words up to a known number of whitespace.
i.e. 5 white space characters between tokens.
foo bar foo bar foo bar = between the first foo and last bar....there are 5 space.
foo bar = this also has 5 spaces between the first foo and last bar.
开发者_开发知识库Anyone have the regular expression to find both of these....and variations of spaces?
\S*(\s\S*){N}
where N is the number of whitespace characters you want. Note, also matches a string of N whitespace characters without anything in between them.
精彩评论