lizhongbo 发表于 2020-7-23 14:32:00

正则表达式求助

# dmidecode 2.10
SMBIOS 3.0 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: ASUSTeK COMPUTER INC.
        Product Name: H110M-F
        Version: Rev X.0x
        Serial Number: 170502630721219
        Asset Tag: Default string
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: Default string
        Chassis Handle: 0x0003
        Type: Motherboard
        Contained Object Handles: 0

Handle 0x0036, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 32 GB
        Error Information Handle: Not Provided
        Number Of Devices: 2

Handle 0x0037, DMI type 17, 40 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: DIMM
        Set: None
        Locator: ChannelA-DIMM1
        Bank Locator: BANK 0
        Type: <OUT OF SPEC>
        Type Detail: Synchronous
        Speed: 2133 MHz
        Manufacturer: 0875
        Serial Number: C314000A
        Asset Tag: 9876543210
        Part Number: JHD2133U1504JY      
        Rank: 1

Handle 0x0038, DMI type 17, 40 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: DIMM
        Set: None
        Locator: ChannelB-DIMM1
        Bank Locator: BANK 2
        Type: <OUT OF SPEC>
        Type Detail: Synchronous
        Speed: 2133 MHz
        Manufacturer: GEIL
        Serial Number: 00000000
        Asset Tag: 9876543210
        Part Number: CL17-17-17 D4-2400
        Rank: 1

Handle 0x003D, DMI type 4, 48 bytes
Processor Information
        Socket Designation: LGA1151
        Type: Central Processor
        Family: Celeron
        Manufacturer: Intel(R) Corporation
        ID: E9 06 09 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 158, Stepping 9
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Hyper-threading technology)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Celeron(R) CPU G3930 @ 2.90GHz
        Voltage: 0.9 V
        External Clock: 100 MHz
        Max Speed: 8300 MHz
        Current Speed: 2900 MHz
        Status: Populated, Enabled
        Upgrade: Other
        L1 Cache Handle: 0x003A
        L2 Cache Handle: 0x003B
        L3 Cache Handle: 0x003C
        Serial Number: To Be Filled By O.E.M.
        Asset Tag: To Be Filled By O.E.M.
        Part Number: To Be Filled By O.E.M.
        Core Count: 2
        Core Enabled: 2
        Thread Count: 2
        Characteristics:
                64-bit capable




正则要取的内容 ASUSTeK COMPUTER INC.
H110M-F
32 GB
Number Of Devices: 2 这里的2
ChannelA-DIMM1
0875
4096 MB
2133 MHz
ChannelB-DIMM1
4096 MB
GEIL
4096 MB
2133 MHz

Intel(R) Celeron(R) CPU G3930 @ 2.90GHz
LGA1151

Core Enabled: 2 这里的2

希望大神帮下忙,谢谢了








lizhongbo 发表于 2020-7-23 15:21:35

自己搞定了,代码如下

(?m)Manufacturer:(.+?)\r

ASUSTeK COMPUTER INC.
0875
GEIL
Intel(R) Corporation
[完毕]
---------------------------------------
(?m)Size:(.+?)\r
4096 MB
4096 MB
[完毕]
---------------------
(?m)Locator: (.+?)\r

ChannelA-DIMM1
BANK 0
ChannelB-DIMM1
BANK 2
[完毕]
--------------------
(?m)Speed: (.+?)\r
2133 MHz
2133 MHz
8300 MHz
2900 MHz
[完毕]
-------------------------
(?m)Maximum Capacity:(.+?)\r
32 GB
[完毕]
------------------------
(?m)Product Name:(.+?)\r
H110M-F
[完毕]
------------------------------
(?m)Socket Designation:(.+?)\r
LGA1151
[完毕]
---------------------------
(?m)Thread Count:(.+?)\r
2
[完毕]

afan 发表于 2020-7-23 17:21:15

这个的确自己解决最好,因为关键字相同的太多,也只有你自己知道要获取的内容~
分步操作是对的,容易修改。
解决了请修改标题。

lizhongbo 发表于 2020-7-24 14:10:58

afan 发表于 2020-7-23 17:21
这个的确自己解决最好,因为关键字相同的太多,也只有你自己知道要获取的内容~
分步操作是对的,容易修改 ...

这还得感谢A版分享的工具哦!Au3.REHelper
页: [1]
查看完整版本: 正则表达式求助