0

我正在寻找 Regex(用于 Power Automate Desktop)来查找仅包含两个大写字母的行。所以在下面的例子中,它应该只找到第 5 行作为正确的选择。

我试着跟随。它适用于regex101网站,但由于某种原因它在 Power Automate 中不起作用。有什么建议可以纠正这个正则表达式吗?

\b[A-Z]{2}\b\n 

示例文本:

HEllo, how are you
This IS test message
is this OK
where are you. I
AM
here.
4

3 回答 3

0

这应该工作.*\n([A-Z]{2})\n.*

于 2021-10-04T18:18:50.730 回答
0

利用

(?m)^[A-Z]{2}\r?$

解释

--------------------------------------------------------------------------------
  (?m)                     set flags for this block (with ^ and $
                           matching start and end of line) (case-
                           sensitive) (with . not matching \n)
                           (matching whitespace and # normally)
--------------------------------------------------------------------------------
  ^                        the beginning of a "line"
--------------------------------------------------------------------------------
  [A-Z]{2}                 any character of: 'A' to 'Z' (2 times)
--------------------------------------------------------------------------------
  \r?                      '\r' (carriage return) (optional (matching
                           the most amount possible))
--------------------------------------------------------------------------------
  $                        before an optional \n, and the end of a
                           "line"
于 2021-10-04T21:11:05.417 回答
0

这是对我有用的正则表达式。感谢@MikeM 和其他人的快速解答!

\n([A-Z]{2})\r
于 2021-10-04T18:53:28.407 回答