开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜