Notepad++/Regular Expressions search and replace
I'm new to regular expressions so this isn't strictly a Notepad++ question. Here's the text I'm searching through to do a find-and-replace:
$AsgTRNonCapCases = $row['AsgTRNonCapCases']; $AsgRCCapDefs = $row[16]; $AsgRCCapCases = $row[17];
$AsgRCNonCapDefs = $row['']; $AsgRCNonCapCases = $row[19]; $DispGPCapDefs = $row[20];
$DispGPCapCases = $row['']; $DispGPNonCapDefs = $row[22]; $DispGPNonCapCases = $row[23];
$DispDDCapDefs = $row['']; $DispDDCapCases = $row[25]; $DispDDNonCapDefs = $row[26];
$DispDDNonCapCases = $row['']; $DispNPCapDefs = $row[28]; $DispNPCapCases = $row[29];
$DispNPNonCapDefs = $row['']; $DispNPNonCapCases = $row[31]; $DispODCapDefs = $row开发者_如何学JAVA[32];
$DispODCapCases = $row['']; $DispODNonCapDefs = $row[34]; $DispODNonCapCases = $row[35];
$DispBTACapDefs = $row['']; $DispBTACapCases = $row[37]; $DispBTANonCapDefs = $row[38];
$DispBTANonCapCases = $row['']; $DispBTCCapDefs = $row[40]; $DispBTCCapCases = $row[41];
$DispBTCNonCapDefs = $row['']; $DispBTCNonCapCases = $row[43]; $DispJTACapDefs = $row[44];
$DispJTACapCases = $row['']; $DispJTANonCapDefs = $row[46]; $DispJTANonCapCases = $row[47]; $DispJTCCapDefs = $row['']; $DispJTCCapCases = $row[49]; $DispJTCNonCapDefs = $row[50]; $DispJTCNonCapCases = $row[51]; $DispADDCapDefs = $row['']; $DispADDCapCases = $row[53]; $DispADDNonCapDefs = $row[54]; $DispADDNonCapCases = $row['']; $DispSCDCapDefs = $row[56]; $DispSCDCapCases = $row[57]; $DispSCDNonCapDefs = $row[58]; $DispSCDNonCapCases = $row['']; $DispCTOCapDefs = $row[60]; $DispCTOCapCases = $row[61]; $DispCTONonCapDefs = $row['']; $DispCTONonCapCases = $row[63]; $OldCapDefs = $row[64]; $OldCapCases = $row[65]; $OldNonCapDefs = $row['']; $OldNonCapCases = $row[''];
All I've been trying to do is replace the $row[##] with $row [''].
I've tried:
\[##\]
\[0-100\]
and a few others, to no avail. Am I doing something wrong? I have the regular expression checkbox checked.
You probably want to use
\[[0-9]+\]
Which means
\[
a[
symbol (escaped since[
has a special meaning in regular expressions).[0-9]
means any digit+
means one or more of the previous symbol\]
a]
symbol.
Your attempt is slightly wrong:
#
has no special meaning in regular expressions.0-100
(if put in brackets, as[0-100]
) means all characters from0
to1
plus0
and0
, i.e. it's effectively the same as "zero or one".
See this question for generating a regular expression matching a specific numerical range.
don't have notepad++,but could you try:
\[\d{2}\]
\[[0-9][0-9]\]
See Understanding RegEx with Notepad++
精彩评论