我對於Regex是全新的,我想我的問題不會太難回答。 我正在嘗試使用Notepad ++編輯G代碼,並且爲了使機器正常工作,我需要更改一些括號的組合。 我想替換任何嵌套括號(其在G-代碼註釋)_content_
正則表達式查找/替換括號中的值在Notepad ++
例如,我想替換
N33(8141(31) -- Roughing 2)
對於
N33(8141_31_ -- Roughing 2)
的嵌套括號中的內容是從1到50的數字,所以我想解決方案將包含一系列值,如[1-50]。
這是G代碼的修剪樣本。利益線N33,N160和N299:
%
<7641-MF1>
N1(PROGRAM NAME :)
N2(PART NAME :)
N3(PROGRAM DATE :)
N4(PROGRAMMED BY :Alejo)
N5(POWERMILL PROJECT :7641-MF1
N6(MACHINE TOOL :CMS & MODEL :)
N7(CONTROLLER :)
N8(OPTION FILE :)
N9(POWERMILL CB :)
N10(OUTPUT WORKPLANE :G55)
N11(TOOL LIST : 3 TOOLS)
N12(---------------------------------------------------------------------------)
N13(Tool Number| Tool Name|Tool Diameter|Tool Tip Radius|Tool Length)
N14(---------------------------------------------------------------------------)
N15( 15| Tool15| 80| .0| 296)
N16( 9| Tool9| 127| .0| 2418)
N17( 5| Tool5| 19125| .0| 2275)
N18(---------------------------------------------------------------------------)
N19(ESTIMATED CUTTING TIME : 383 TOOLPATHS =1 hours 20 min 5 sec)
N20G21
N21G92.1X0Y0Z0B0C0
N22G55
N23G5.1Q0
N24G52X0Y0Z0
N25G53G90G00G49Z-200H0
N26(TOOL NUMBER : T15)
N27(TOOL NAME : Tool15)
N28(TOOL TYPE : ENDMILL)
N29(TOOL DIAMETER : 80 & LENGTH : H296)
N30T15M6
N31H15
N32G359
N33(8141(31) -- Roughing 2)
N34M3S17000F30000.
N35G43.4H15
N36G1G90X24.855Y140.392B40.0C66.176F30000.
N37G5.1Q1R1
N38Z50.0
N153X187.216Y187.99Z19.445B40.0C142.536
N154X187.162Y188.367Z19.775B40.0C142.536
N155X187.162Y188.367Z19.775B40.0C142.536F30000.
N156X187.162Y188.367Z50.0B40.0C142.536
N157G5.1Q1R1
N158Z50.0
N159X226.555Y251.806Z50.0B-45.559C98.447
N160(8141(30) -- Roughing 1)
N161X226.555Y251.806Z50.0B-45.559C98.447F5000.
N162X226.555Y251.806Z25.058B-45.559C98.447
N292X40.523Y188.223Z18.547B-33.984C134.954
N293X40.502Y187.868Z18.904B-33.984C134.954
N294X40.502Y187.868Z18.904B-33.984C134.954F30000.
N295X40.502Y187.868Z50.0B-33.984C134.954
N296G5.1Q1R1
N297Z50.0
N298X24.855Y285.258Z50.0B40.0C66.176
N299(8141(30) -- Roughing 2)
N300X24.855Y285.258Z50.0B40.0C66.176F5000.
N301X24.855Y285.258Z26.13B40.0C66.176
N302X25.523Y283.851Z24.902B40.0C66.176
N417X187.162Y333.234Z19.775B40.0C142.536F30000.
N418X187.162Y333.234Z50.0B40.0C142.536
@vks,這是一個錯誤。 – Alejo
您可以發送樣本批量內容嗎?這應該工作,如果它在一行^(。*)\\((。*?)\\)(。*?\))取代$ 1_ $ 2_ $ 3 – Raghavendra
@raghavendra,我應該在哪裏發送它?我應該把它附加到這個問題上嗎? – Alejo