开发者

how to construct pattern in regular expression

How to generate a regular expression that will scan a full text file (say, sample.txt) and return开发者_StackOverflow中文版 the index of the first occurance of STRT followed by any number of spaces and then a. That means it can be like

"STRT   ."

or it can be like

"STRT        ."


Try this: @"STRT\s*\."

the \s* will match any number of whitespace characters and . will match the literal period.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜