0
我有一個excel文件。我使用的Apache POI讀取它,但我想篩選符合以下條件的單元格:Java正則表達式基本公式
我只需要提取信息以粗體突出顯示,並專門項目編號前NXXXX而忽略單元格數據的休息,但如果是NXXXX/NXXXXL,然後我需要提取兩個NXXXX & NXXXXL,其他行不具有NXXXX都被忽略。
這裏是我試過到目前爲止:
"N9657"
"N9657/N9657L"
"[N]\\d\\d\\d\\d?|[N]\\d\\d\\d\\d[/][N]\\d\\d\\d\\d[L]?"
上述工作時,我有「N9657」或「N9657/N9657L」,而不是當我有「N9657」更多的文本或「N9657/N9657L」更多文字
那麼任何人都可以幫忙嗎?
連接下面
數據謝謝
Frame/Description
**N1026 MARCOURT Banquette**
Finish: 751 Mocha standard.
Also available in other finishes.
Nailhead Finish: #44 Antique Nickel is standard.
Also available in other finishes.
Pillows: (4) Feather Down throw pillows-knife edge
with welt-22" x 22"
COM Yardage: 15.3
Construction: Sinuous Spring
Weight 180 Cubic Feet 72.54
**N1080/N1080L BROMLEY Cocktail Ottoman**
Finish: New Oxide only
COM Yardage: 3.00
COL Square Footage: 48 SQ. FT.
Construction: Fiesta Webbing
Miscellaneous: Exposed Metal Base
Weight 65 Cubic Feet 15.95
請參閱http://www.vogella.com/articles/JavaRegularExpressions/article.html – Krease
一個簡單的匹配正則表達式是「N \\ d +(?:/ N \\ d + L)?」' – sln
I認爲這是行得通的[N] \\ d \\ d \\ d \\ d。* | [N] \\ d \\ d \\ d \\ d [/] [N] \\ d \\ d \ \ d \\ d [L]。* – skystar7