I'm fairly new to the regex world and I need to know if it's possible to create a regex which searches through a single sgm file for a specific set of tags, then copies the tags along with the text between them to a new file. There could be up to 4,000 sets of this particular tab set within the sgm file so the result could be up to 4,000 files created. The process should be non-destructive to the sgm file.
Here's an example. I need to extract <pgblk...>and everything in between</pgblk>
Code: Select all
<title>TIME LIMITS/MAINTENANCE CHECKS</title>
<subject CHAPNBR="05" SECTNBR="00" SUBJNBR="00" CHG="U" KEY="L6DF0EE9E1F38A18709C55DB7192C880" REVDATE="20100220">
<title>TIME LIMITS/MAINTENANCE CHECKS</title>
<pgblk CHAPNBR="05" SECTNBR="00" SUBJNBR="00" PGBLKNBR="2" CHG="U" KEY="MADF4B8D4A7D65977A88931E5E060A1A" REVDATE="20100220">
<effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<title>TIME LIMITS/MAINTENANCE CHECKS - MAINTENANCE PRACTICES</title>
<task CHAPNBR="05" SECTNBR="00" SUBJNBR="00" FUNC="912" SEQ="001" PGBLKNBR="2" CHG="R" KEY="A7532B68DE884B47FAD1096080489C68" REVDATE="20100520">
<effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Added data to clarify lightning strike zone data and clarify fastener cap sealing requirements for ignition prevention.</chgdesc>
<title>Airworthiness Limitation Precautions</title>
<tfmatr>
<pretopic>
<title>General</title>
<list1>
<l1item>
<para>Critical Design Configuration Control Limitations (CDCCLs)<revst> <revend></para>
<list2>
<l2item>
<para>All occurrences of CDCCLs found in this chapter of the AMM are identified by this note after each applicable CDCCL design feature:<revst> <revend></para>
<list3>
<l3item>
<para>NOTE: CDCCL - Refer to the task: <revst><refint REFTYPE="task" REFID="A7532B68DE884B47FAD1096080489C68">Airworthiness Limitation Precautions, TASK 05-00-00-912-001</refint><revend>, for important information on Critical Design Configuration Control Limitations (CDCCLs).</para>
</l3item>
</list3>
</l2item>
<l2item>
<revst><revend><para><revst>Design features that are CDCCLs are defined and controlled by Special Federal Aviation Regulation (SFAR) 88, and can be found in Section 9 of the Maintenance Planning Data (MPD) document. <revend>CDCCLs are a means of identifying certain design configuration features intended to preclude a fuel tank ignition source for the operational life of the airplane. CDCCLs are mandatory and cannot be changed or deleted without the approval of the FAA office that is responsible for the airplane model Type Certificate, or applicable regulatory agency. A critical fuel tank ignition source prevention feature may exist in the fuel system and its related installation or in systems that, if a failure condition were to develop, could interact with the fuel system in such a way that an unsafe condition would develop without this limitation. Strict adherence to configuration, methods, techniques, and practices as prescribed is required to ensure the CDCCL is complied with. Any use of parts, methods, techniques or practices not contained in the applicable CDCCL must be approved by the FAA office that is responsible for the airplane model Type Certificate, or applicable regulatory agency.</para>
</l2item>
</list2>
</l1item>
<l1item>
<para>Airworthiness Limitation Instructions (ALIs)</para>
<list2>
<l2item>
<para>All occurrences of fuel tank system ALIs found in this chapter of the AMM are identified by this step after the General section in the applicable ALI inspection task:<revst> <revend></para>
<list3>
<l3item>
<para>ALI - Refer to the task: <revst><refint REFTYPE="task" REFID="A7532B68DE884B47FAD1096080489C68">Airworthiness Limitation Precautions, TASK 05-00-00-912-001</refint><revend>, for important information on airworthiness limitation instructions (ALIs).</para>
</l3item>
</list3>
</l2item>
<l2item>
<revst><revend><para><revst>Inspection tasks that are ALIs are defined and controlled by Special Federal Aviation Regulation (SFAR) 88, and can be found in Section 9 of the Maintenance Planning Data (MPD) document. <revend>These ALIs identify inspection tasks related to fuel tank ignition source prevention which must be done to maintain the design level of safety for the operational life of the airplane. These ALIs are mandatory and cannot be changed or deleted without the approval of the FAA office that is responsible for the airplane model Type Certificate, or applicable regulatory agency. Strict adherence to methods, techniques and practices as prescribed is required to ensure the ALI is complied with. Any use of methods, techniques or practices not contained in these ALIs must be approved by the FAA office that is responsible for the airplane model Type Certificate, or applicable regulatory agency.</para>
</l2item>
</list2>
</l1item>
<revst><l1item>
<para>Equivalent Tools, Fixtures, Test Equipment, and Consumable Materials</para>
<list2>
<l2item>
<para>When the procedures in this manual identify tools, equipment, and consumable materials, you can use equivalent alternatives. If you use alternative tools, equipment, or consumable materials, make sure that they give the same results and are as safe to the parts and personnel as the tools, equipment, or consumable materials specified in the procedure.</para>
</l2item>
</list2>
</l1item>
<l1item>
<para>Enhanced Zonal Analysis Procedure (EZAP) and associated Electrical Wiring Interconnection System (EWIS)</para>
<list2>
<l2item>
<para>Enhanced Zonal Analysis Procedure (EZAP) is an analytical procedure required by Part 25, Appendix H, Section H25.5(a)(1) that identifies the physical and environmental conditions contained in each zone of an airplane, analyzes the effects of these conditions on electrical wiring and components, and assesses the possibilities for smoke and fire. The end result of the analysis are inspection and restoration tasks in the form of EWIS ICA.</para>
</l2item>
<l2item>
<para>Electrical Wiring Interconnection System (EWIS): means any wire, power feeder, wiring device, or combination of these, including termination devices, installed in any area of the airplane for the purpose of transmitting electrical energy, including data and signals, between two or more intended termination points. EWIS is defined in full by 14 CFR section 25.1701.</para>
</l2item>
<l2item>
<para>The Zonal Inspection Program includes a general visual and, if required, physical check of the general condition and security of attachment of the accessible systems and structures items contained in defined zones. This includes checks for degradation such as chafing of tubing, loose duct supports, damage to wiring and connected EWIS, cable and pulley wear, fluid leaks, electrical bonding, general condition of fasteners, inadequate drainage, etc., and general corrosion, not covered in the MSG-3 analysis. The zonal inspection is not intended as a quality assurance after maintenance check for determining proper reassembly of systems, components, structures, or powerplants. The zonal program packages a number of General Visual (GV) Inspections into one or more zonal inspections. The program includes any GV inspection tasks required to assure security of attachment and general condition of any system or structural items within the zone.</para>
</l2item>
</list2>
</l1item>
<revend></list1>
</pretopic>
<revst><pretopic>
<title>References</title>
<table FRAME="NONE">
<tgroup COLS="2" COLSEP="0" ROWSEP="0">
<colspec COLWIDTH="180*"><colspec COLWIDTH="420*"><thead>
<row ROWSEP="1">
<entry>
<para>Reference</para>
</entry>
<entry>
<para>Title</para>
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<para><refext REFMAN="SRM" REFLOC="57-00-00">SRM 57-00-00</refext></para>
</entry>
<entry>
<para>Wings</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</pretopic>
<revend><pretopic>
<revst><revend><title>Location Zones</title>
<table FRAME="NONE">
<tgroup COLS="2" COLSEP="0" ROWSEP="0">
<colspec COLWIDTH="180*"><colspec COLWIDTH="420*"><thead>
<row ROWSEP="1">
<entry>
<para>Zone</para>
</entry>
<entry>
<para>Area</para>
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<para><zone>100</zone></para>
</entry>
<entry>
<para>Lower Half of Fuselage</para>
</entry>
</row>
<row>
<entry>
<para><zone>200</zone></para>
</entry>
<entry>
<para>Upper Half of Fuselage</para>
</entry>
</row>
<row>
<entry>
<para><zone>500</zone></para>
</entry>
<entry>
<para>Left Wing</para>
</entry>
</row>
<row>
<entry>
<para><zone>600</zone></para>
</entry>
<entry>
<para>Right Wing</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</pretopic>
</tfmatr>
<topic>
<revst><revend><title>Critical Design Configuration Control Limitations (CDCCLs)</title>
<subtask CHAPNBR="05" SECTNBR="00" SUBJNBR="00" FUNC="912" SEQ="002" PGBLKNBR="2" CHG="R" KEY="EEE3D48B0C074CC1E2CE0ABE0D36CEE1" REVDATE="20100520">
<effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Revised</chgdesc>
<list1>
<l1item>
<warning>
<para>OBEY THE MANUFACTURER'S PROCEDURES WHEN YOU DO<revst><revend> MAINTENANCE THAT <revst>HAS AN EFFECT ON<revend> A CDCCL. IF YOU DO NOT <revst>OBEY<revend> THE PROCEDURES, IT CAN INCREASE THE RISK OF A<revst> SOURCE OF<revend> FUEL TANK IGNITION<revst>. INJURIES TO PERSONNEL, AND DAMAGE TO EQUIPMENT CAN OCCUR IF THERE IS A FIRE OR EXPLOSION<revend>.</para>
</warning>
<para>Make sure you follow the procedures for items identified as CDCCLs.</para>
</l1item>
</list1>
</subtask>
</topic>
<topic>
<revst><revend><title>Airworthiness Limitation Instructions (ALIs)</title>
<subtask CHAPNBR="05" SECTNBR="00" SUBJNBR="00" FUNC="912" SEQ="003" PGBLKNBR="2" CHG="R" KEY="E7F8A6159CD69475A9E6CD4A23D0939F" REVDATE="20100520">
<effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Revised</chgdesc>
<list1>
<l1item>
<warning>
<para>OBEY THE MANUFACTURER<revst>`<revend>S PROCEDURES WHEN YOU DO ANY MAINTENANCE THAT MAY AFFECT AN ALI. IF YOU DO NOT FOLLOW THE PROCEDURES, IT CAN INCREASE THE RISK OF A FUEL TANK IGNITION SOURCE.</para>
</warning>
<para>Make sure you follow the procedures for tasks identified as ALIs.</para>
</l1item>
</list1>
</subtask>
<revst><revend><subtask CHAPNBR="05" SECTNBR="00" SUBJNBR="00" FUNC="910" SEQ="002" PGBLKNBR="2" CHG="N" KEY="G3C7D628726D6ABAA0F24D66ACF31B10" REVDATE="20100520">
<revst><effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Added data to clarify lightning strike zone data and clarify fastener cap sealing requirements for ignition prevention.</chgdesc>
<chgdesc>Added SUBTASK 05-00-00-910-002</chgdesc>
<list1>
<l1item>
<para>See <refext REFMAN="SRM" REFLOC="57-00-00">SRM 57-00-00</refext> for installation guidelines for fasteners that penetrate the fuel tank.</para>
</l1item>
</list1>
<revend></subtask>
<revst><revend></topic>
<revst><topic>
<title>Enhanced Zonal Analysis Procedure (EZAP) and associated Electrical Wiring Interconnection System (EWIS)</title>
<revend><subtask CHAPNBR="05" SECTNBR="00" SUBJNBR="00" FUNC="910" SEQ="001" PGBLKNBR="2" CHG="N" KEY="ME378CA58614F1E347A692448FD519FA" REVDATE="20100520">
<revst><effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Added SUBTASK 05-00-00-910-001</chgdesc>
<list1>
<l1item>
<warning>
<para>OBEY THE MANUFACTURER'S PROCEDURES WHEN YOU DO EZAP MAINTENANCE, OR MAINTENANCE THAT HAS AN EFFECT ON EWIS. IF YOU DO NOT OBEY THE PROCEDURES, IT CAN INCREASE THE RISK OF AN IGNITION SOURCE FOR FIRES. INJURIES TO PERSONS, AND DAMAGE TO EQUIPMENT CAN OCCUR.</para>
</warning>
<para>Make sure you follow the procedures for items identified as EZAP. </para>
</l1item>
</list1>
<revend></subtask>
<revst></topic>
<revend></task>
</pgblk>
</subject>
<subject CHAPNBR="05" SECTNBR="00" SUBJNBR="01" CHG="U" KEY="D1D07D028AB265233AC8FFB42ED419AA" REVDATE="20100220">
<title>GENERAL INFORMATION</title>
<pgblk CHAPNBR="05" SECTNBR="00" SUBJNBR="01" PGBLKNBR="6" CHG="R" KEY="CAA62EA22EA098BD8E75247115D30D41" REVDATE="20100520">
<effect EFFRG="501590 592999" EFFTEXT="ALL">
</effect>
<chgdesc>Revised</chgdesc>
<title>TASK CARD DEFINITIONS</title>