开发者

Visual Studio Regular Expressions - Matching first word in a file

开发者 https://www.devze.com 2023-02-27 14:22 出处:网络
Is it possible to match the first word in a file using Visual Studio Regex? e.g. ^using matches 开发者_开发百科multiple statements where \"using\" matches the first five characters on a line.

Is it possible to match the first word in a file using Visual Studio Regex?

e.g. ^using matches 开发者_开发百科multiple statements where "using" matches the first five characters on a line.

I need to find and replace the only first using statement where "using" matches the first five characters in the file.

Thanks,

M


Well, regex matches against a string. So, you could try reading the first line of the file into a string and execute a regex match against that string.

0

精彩评论

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