MAtch表达式和读取修改文件 [英] MAtch expression and read modify file

查看:74
本文介绍了MAtch表达式和读取修改文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从正则表达式匹配的点读取文件并继续阅读直到我点击另一个正则表达式;在读取文件的这一部分时(已知大小的二进制字符串;搜索适当的位置,通过fil解析,进行替换);

解决方案

查看该行我正在那里寻找那条那条线就在那里

你看不到它?


到目前为止你有什么尝试?


添加更多我之前写的内容:

有两个输入文件:用于步骤1)& 3)和第二步在步骤2


解析输入文件,它基本上给了我三个变量;

三个变量中有两个是正则表达式和一个整数,

我匹配第一个正则表达式然后在两行之后我有硬编码表达式然后我匹配我的第二个正则表达式从这一点开始有多行的二进制文件串我需要计算位数等于第三个变量(整数)的值,并用已知字符替换;

然后我从输入文件中选择另一行并重复相同的过程;


简而言之,这就是我所做的(第1步和第3步)以及我被困住的地方(第2步):

1)打开并阅读inputfile1的第一行给出一个字符串,最后给出三个变量

2)两个是正则表达式一个整数;使用它们来替换具有已知字符的二进制文件;我被困在如何阅读和替换知识字符的二进制文件

3)从输入文件的下一行重复2


我做了1) &安培; 3).............错过了问题的核心步骤2)



我解析了输入文件基本上给了我三个变量;

三个变量中的两个是正则表达式和一个整数,

我匹配第一个正则表达式然后在两行之后我很难编码表达式,然后我匹配我的第二个正则表达式,从这一点开始,在多行中有二进制字符串,我需要将位计数到等于第三个变量(整数)的值,并替换为已知字符;

然后我从输入文件中选择另一行并重复相同的过程;

这里就是我所做的和我被困住的地方:

1)打开并读取inputfile1的第一行,它给出一个字符串,最后是三个变量

2)两个是规则表达式的一个整数;用它们替换知识字符的二进制文件

3)用输入文件中的下一行重复2


我做过1)& 3).............错过了问题的核心步骤2)



发布到目前为止你写的代码。 / BLOCKQUOTE>

I want to read a file from a point where a regular expression matches and keep on reading till i hit another regular expression; while reading this part of the file ( binary strings of known size; search the appropriate position, parsed through a fil, make a replacement);

解决方案

Look theres that Line that im looking for look right there thats the line right there
you cant see it ???

what have you attempted so far?


Adding more to what I wrote earlier:
there are two input file: used in step 1) & 3) and second one at step 2

parsed the input file which basically gives me three variables;
out of three varibles two are regular expression and one integer,
I match the first regular expression then after two line i have hard coded expression then i match my second regular expression from this point onwards there are strings of binaries in multiple line and i need to count the bits to the value equal to third variable (integer) and replace with known character;
then i pick another line from input file and repeatt the same process;

In short here is what i have done (step 1 &3) and where i am stuck (step 2 ):
1)Open and read first line of inputfile1 which gives a string and eventually three variables
2) two are regular expression one integer; use them to rplace the binary with know character; i am stuck as to how i read and replace the binary with know character
3) repeat 2 with next line from input file

I have done 1) & 3).............missing the heart of the problem step 2)


I parsed the input file which basically gives me three variables;
out of three varibles two are regular expression and one integer,
I match the first regular expression then after two line i have hard coded expression then i match my second regular expression from this point onwards there are strings of binaries in multiple line and i need to count the bits to the value equal to third variable (integer) and replace with known character;
then i pick another line from input file and repeatt the same process;
in short here is what i have done and where i am stuck:
1)Open and read first line of inputfile1 which gives a string and eventually three variables
2) two are regilar expression one integer; use them to rplace the binary witj know character
3) repeat 2 with next line from input file

I have done 1) & 3).............missing the heart of the problem step 2)

Post the code you have written so far.


这篇关于MAtch表达式和读取修改文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆