PDFファイルから抽出したテキストファイルから取得したString変数中の改行コードの数え方

こんにちは
UiPath Studio 2025.0.167STS Community editionのユーザーです。

事実関係を確認させてください。
かつて働いた職場の同僚から、
PDFファイルから抽出したテキストファイルから取得したString変数str_Text中の改行コードの数え方は、下記構文だと教わりました。
int_NewLineCount = str_Text.Count(Function(c) c = Chr(10))

一応その節は上記構文で動きましたが、テキストファイル内の改行コードはテキストエディターによりコードが異なることから、下記が正しい(より良い)構文と考えますがいかがでしょうか?
int_NewLineCount = System.Text.RegularExpressions.Regex.Matches(str_Text, "\r\n|\r|\n").Count

Hi @gorby

The method taught by your colleague using Chr(10) counts only line feed characters and may miss other newline types. The improved method using regular expressions counts all common newline formats (\r\n, \n, \r), making it more accurate and reliable.

Happy automation