![Notepad++ 删除除 40 个变量之外的所有内容,将它们放在自己的行上,并组合正则表达式](https://linux22.com/image/1457248/Notepad%2B%2B%20%E5%88%A0%E9%99%A4%E9%99%A4%2040%20%E4%B8%AA%E5%8F%98%E9%87%8F%E4%B9%8B%E5%A4%96%E7%9A%84%E6%89%80%E6%9C%89%E5%86%85%E5%AE%B9%EF%BC%8C%E5%B0%86%E5%AE%83%E4%BB%AC%E6%94%BE%E5%9C%A8%E8%87%AA%E5%B7%B1%E7%9A%84%E8%A1%8C%E4%B8%8A%EF%BC%8C%E5%B9%B6%E7%BB%84%E5%90%88%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F.png)
我在 Notepad++ 中。我在一个大型 html 文件中嵌入了以下数据。我想将</ix:nonNumeric>
行末之前的变量单独放到它们自己的行上,因此输出为:
00891906 1.12.13 30.11.14 30.11.14 Company Accounts Private Limited Company
ETC。
还有更多数据,但如果我可以使用正则表达式来执行此操作,我将能够解决其余问题。谢谢。一旦开始工作,我将在目录中使用批量替换并对多个 txt 文件执行此操作。
`<ix:hidden>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:NameAuthor" order="1" tupleRef="XBRLDocumentAuthorGrouping_Group45" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL"></ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:DescriptionOrTitleAuthor" order="2" tupleRef="XBRLDocumentAuthorGrouping_Group45" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL"></ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:UKCompaniesHouseRegisteredNumber" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">00891906</ix:nonNumeric>
<ix:nonNumeric contextRef="CountriesHypercube_FY_30_11_2014_Set1" name="ns7:CountryFormationOrIncorporation" format="ixt2:nocontent" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" />
<ix:nonNumeric contextRef="CurrenciesHypercube_FY_30_11_2014_Set2" name="ns7:PrincipalCurrencyUsedInBusinessReport" format="ixt2:nocontent" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" />
<ix:nonNumeric contextRef="EntityOfficersHypercube_FY_30_11_2014_Set3" name="ns5:NameDirectorSigningAccounts" format="ixt2:nocontent" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" />
<ix:nonNumeric contextRef="cfwd_30_11_2014" name="ns7:StartDateForPeriodCoveredByReport" format="ixt2:datedaymonthyear" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">1.12.13</ix:nonNumeric>
<ix:nonNumeric contextRef="cfwd_30_11_2014" name="ns7:EndDateForPeriodCoveredByReport" format="ixt2:datedaymonthyear" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">30.11.14</ix:nonNumeric>
<ix:nonNumeric contextRef="cfwd_30_11_2014" name="ns7:BalanceSheetDate" format="ixt2:datedaymonthyear" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">30.11.14</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:EntityAccountsType" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">Company accounts</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:LegalFormOfEntity" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">Private Limited Company</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:DescriptionPeriodCoveredByReport" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">FY</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:EntityTrading" format="ixt2:booleantrue" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">true</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns7:EntityDormant" format="ixt2:booleanfalse" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">false</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns5:AccountsPreparedUnderHistoricalCostConventionInAccordanceWithFRSSE" format="ixt2:booleantrue" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">true</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns5:CompanyExemptFromPreparingCashFlowStatementUnderFRS1" format="ixt2:booleanfalse" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">false</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns5:AccountsHaveBeenPreparedInAccordanceWithProvisionsSmallCompaniesRegime" format="ixt2:booleantrue" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">true</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns5:RelatedPartyTransactionExemptionBeingClaimed" format="ixt2:booleanfalse" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">false</ix:nonNumeric>
<ix:nonNumeric contextRef="FY_30_11_2014" name="ns6:CompanyHasActedAsAnAgentDuringPeriod" format="ixt2:booleanfalse" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">false</ix:nonNumeric>
<ix:nonNumeric contextRef="SharesHypercube_FY_30_11_2014_Set4" name="ns7:DescriptionShareType" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">Ordinary</ix:nonNumeric>
<ix:nonFraction contextRef="SharesHypercube_FY_30_11_2014_Set4" name="ns5:ParValueShare" unitRef="GBP" decimals="INF" format="ixt2:numdotdecimal" scale="0" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL">1.00000</ix:nonFraction>
<ix:tuple name="ns7:XBRLDocumentAuthorGrouping" tupleID="XBRLDocumentAuthorGrouping_Group45" /></ix:hidden>
<ix:references>
<link:schemaRef xlink:href="http://www.xbrl.org/uk/gaap/core/2009-09-01/uk-gaap-full-2009-09-01.xsd" xlink:type="simple" /></ix:references>
<ix:resources>
<xbrli:unit id="GBP"><xbrli:measure>iso4217:GBP</xbrli:measure></xbrli:unit><xbrli:unit id="USD"><xbrli:measure>iso4217:USD</xbrli:measure>`
答案1
根据您给出的示例,以下正则表达式将起作用:
找什么:
.+?(<.+?>)(.+?)(<.+?>)
用。。。来代替:
\2\r
您的数据将产生以下结果:
VARIABLE 1
VARIABLE 2
VARIABLE 3
randomrandom random randomrandom random randomrandom random random randomrandom random randomrandom random
只有最后一行不会被过滤掉,但可以手动删除。