如何在Libreoffice中通过Regex过滤?

发布于 2025-01-25 10:17:00 字数 310 浏览 1 评论 0原文

我已经有一个字符串:

{"success":true,"lowest_price":"1,49€","volume":"1,132","median_price":"1,49€"}

现在,我希望在单元格中显示Median_price的值。我可以用正则表达式实现这一目标吗?

有了Regex101.com,我来了这个解决方案:

(?<=median_price":")\d{0,4},\d{2}€

但是这个解决方案似乎在libreoffice calc中工作。

I've got this string:

{"success":true,"lowest_price":"1,49€","volume":"1,132","median_price":"1,49€"}

Now I want the value for median_price being displayed in a cell. HHow can I achive this with Regex?

With regex101.com I've came to this solution:

(?<=median_price":")\d{0,4},\d{2}€

But this one does not seem to be working in LibreOffice calc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别闹i 2025-02-01 10:17:00

我建议首先丢弃欧元符号,因为您可能想检索一个数值值来计算的值。因此尝试:

“在此处输入图像描述”

b1中的公式:

=--REGEX(A1;".*median_price"":""(\d+(?:,\d+)?)€.*";"$1")

双UNARY将将结果从第一个捕获组转换为一个数字。然后,我继续格式化单元格以显示货币( ctrl + shift + 4 )。


注意:我的常规图案略有不同。但是,请使用我支持的任何有用的数据。

I'd advise to discard the Euro-symbol at first since you'd probably want to retrieve a value to calculate with, a numeric value. Therefor try:

enter image description here

Formula in B1:

=--REGEX(A1;".*median_price"":""(\d+(?:,\d+)?)€.*";"$1")

The double unary will transform the result from the 1st capture group into a number. I then went ahead and formatted the cell to display currency (Ctrl+Shift+4).


Note: I went with a slightly different regular pattern. But go with whatever works for your data I supppose.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文