1
我试图匹配正则表达式和文本,但很难找到完全匹配。 这里是测试文本正则表达式检测换行符
SimulationControl,
\unique-object
\memo Note that the following 3 fields are related to the Sizing:Zone, Sizing:System,
\memo and Sizing:Plant objects. Having these fields set to Yes but no corresponding
\memo Sizing object will not cause the sizing to be done. However, having any of these
\memo fields set to No, the corresponding Sizing object is ignored.
\memo Note also, if you want to do system sizing, you must also do zone sizing in the same
\memo run or an error will result.
A1, \field Do Zone Sizing Calculation
\note If Yes, Zone sizing is accomplished from corresponding Sizing:Zone objects
\note and autosize fields.
\type choice
\key Yes
\key No
\default No
A2, \field Do System Sizing Calculation
\note If Yes, System sizing is accomplished from corresponding Sizing:System objects
\note and autosize fields.
\note If Yes, Zone sizing (previous field) must also be Yes.
\type choice
\key Yes
\key No
\default No
Building,
\memo Describes parameters that are used during the simulation
\memo of the building. There are necessary correlations between the entries for
\memo this object and some entries in the Site:WeatherStation and
\memo Site:HeightVariation objects, specifically the Terrain field.
所以我所试图做的是“建筑”上课前只选择文本。 这就是我做的正则表达式,但我不能检测空行前“大厦”,所以我可以前停下来,所以它选择所有文字
^[A-Z].*?,(\s*\\.*)*\s*[a-zA-Z0-9,\s\\:.\(\)\*;]*\n
这是我所期待的恭维,但我还有一个问题,该文件由几个像这样的块组成,那么我能做些什么来在文档中间选择一个块,例如,谢谢 – Helmi
@Helmi:什么标准?请在下次尝试在原始问题中提供这些附加问题,这对每个人都很清楚。我编辑了答案。 – Robin
在许多情况下,您不能确定“空行”完全没有空格(空格,制表符)。那么使用'\ n \ s * \ n'这样的模式代替'\ n \ n'可能会很好。 '\ s'匹配任何空格字符。 – SebastianH