大佬们怎么用正则定位到 这样的内容 XXXXXX : 8

AzsharR:processor : 0
BogoMIPS : 38.40
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x51
CPU architecture: 8
CPU variant : 0x2
CPU part : 0x201
CPU revision : 1

processor : 1
BogoMIPS : 38.40
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x51
CPU architecture: 8
CPU variant : 0x2
CPU part : 0x201
CPU revision : 1

就是定位到上面这样的

下面是我自己写的
re.findall(r'processor[\s\w\d]{1}', a)
结果是['processor\t', 'processor\t', 'processor\t', 'processor\t']
并定位不到 完整的内容

forty:定啥定啊,直接按连续 2 个换行符分割不就行了吗?

Rxianbei:@forty 很有道理

umissthestars:/(\n.*?architecture\s?[::]\s?8.*?)(?!\n)/gi

// example
```
const str = `processor : 0 BogoMIPS : 38.40 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 CPU implementer : 0x51 CPU architecture: 8 CPU variant : 0x2 CPU part : 0x201 CPU revision : 1

processor : 1 BogoMIPS : 38.40 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 CPU implementer : 0x51 CPU architecture: 8 CPU variant : 0x2 CPU part : 0x201 CPU revision : 1

processor : 2 BogoMIPS : 38.40 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 CPU implementer : 0x51 CPU architecture: 8 CPU variant : 0x2 CPU part : 0x205 CPU revision : 1

processor : 3 BogoMIPS : 38.40 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 CPU implementer : 0x51 CPU architecture: 8 CPU variant : 0x2 CPU part : 0x205 CPU revision : 1`
```
// output
```
["↵processor : 1 BogoMIPS : 38.40 Features : fp asim… crc32 CPU implementer : 0x51 CPU architecture: 8", "↵processor : 2 BogoMIPS : 38.40 Features : fp asim… crc32 CPU implementer : 0x51 CPU architecture: 8", "↵processor : 3 BogoMIPS : 38.40 Features : fp asim… crc32 CPU implementer : 0x51 CPU architecture: 8"]
```

qazwsxkevin:import re
tarString = "CPU architecture: 8"
getStr = re.sub('(?<=:).*?(?=$")', 'utf-8', tarString)

# 方法 2,必定是数字的话
getStr = re.findall(r"\d+",tarString)

AzsharR:@forty 因为每次,内容不同,所以需要定位 processor 这个关键词查看后面内容,但是又因为 processor 后面又很多空格定位不到

umissthestars:你这输入和我进来时的不一样了...你又偷偷更新了

AzsharR:@umissthestars 别不好意思 因为呈现出来的格式打乱了 改了一下

关于 CPU 的疑问

Akikiki:买了新的 MBP ( 2020 款),我的 CPU 是 2.0GHz Intel Core i5 四核。同事打开公司电脑( 2017 款)看了下是 3.1 GHz Intel Core i5。 想咨询下哪个性能更好点?zhaidoudou123:2017 款 13 寸?那不用比了,你的秒了他的 Leonard:2017 款是双核 i5 吧 c…

有没控制程序 cpu 使用的开源项目?

52coder:有没控制程序 cpu 使用的开源项目?我目前在 github 上就找到一个 7 8 年没维护的项目 cpulimit,大致使用方法: ./cpulimit --limit 30 process_name ./process_name 大概看了下代码,当 cpu 超过后会发送 stop,sleep 一段时间后发送 cont 信号,代码大致搂了一…

LOL 烧 CPU?

jasonding:最近 LOL 一直觉得卡,漂移那种。刚开始没在意,因为我有游戏设置自动更新,可能恰巧更新了卡一下。结果昨天开窗口毕竟多,想着关几个看看,资源管理器一开发现 CPU100%了,内存也 80%了确实我配置比较差( i5-4590 + 1050TI + 16G ),但是也不至于需要这么大算力吧shpkng:烧不烧你看一眼 LOL 的 CPU 占…

急等大佬回复!服务器 CPU 和内存被小偷抠了,硬盘还在,是 RAID5,可以有办法先把数据恢复出来吗??

qwerthhusn:服务器是 Dell R730 。 操作系统是 CentOS7,文件系统是默认的 XFS 。安装 OS 的时候也没有选任何的数据加密。 有 8 块 500G 的 SAS 硬盘。 数据比较重要,我现在只关心的是如何把数据安全弄出来。 重新配 CPU 内存的话,不知道系统能不能正常起来,会不会损坏数据,,,,, 跪求大佬解释下。iddddg:…

AMD Ryzen 系列 CPU 对虚拟化的支持怎样了?

feather12315:VMware EXSi 、KVM 在 Ryzen 上使用没啥性能上的问题吧?想了解 APU 的显卡,在 KVM 、EXSi 的直通支持情况,有人尝试过吗?用作虚拟化的 hypervisor,4650G 与 10500/10400,更推荐哪一个呢?2067:新系统一般问题不大,喜欢玩老系统的话不推荐物理独立显卡是可以直通的,不过集成显…