04-19-2023 06:58 AM
This VI causes my LV 2021 32bit to crash, but not with 64bit LV. Is there something wrong with the regex itself? On regex101 it works flawlessly.
04-19-2023 07:03 AM
Even it crashes LV2023 (32bit).
Note: I don't have 64bit installed
04-19-2023 07:15 AM
Some more investigation - if I shorten the string part between the "recipeAttributeList", it works and executes in no time. I did some benchmark with putting more and more text in the string input and for me it stops working at ~ 2780 characters, see the example. No memory raise detected.
03-11-2026 09:45 AM
I have a regex example that crashes LabVIEW 2022Q3 64 bits by calling Search and Replace String.
Pretty sure some excessive greedy backtracking is causing the problem and we've replaced this with something that doesn't crash, though maybe LabVIEW could just error out somehow and not go puff.
03-11-2026 10:05 AM
Is it a crash or does it just return an error? LV regex I think is based on PCRE so will return an error on encountering a null character.
03-11-2026 10:10 AM
@billko wrote:
Is it a crash or does it just return an error? LV regex I think is based on PCRE so will return an error on encountering a null character.
Hard crash. No nulls in the string. Probably recursion / out of stack space when doing greedy backtracking.
03-12-2026 02:44 AM
@instrumento wrote:
I have a regex example that crashes LabVIEW 2022Q3 64 bits by calling Search and Replace String.
Pretty sure some excessive greedy backtracking is causing the problem and we've replaced this with something that doesn't crash, though maybe LabVIEW could just error out somehow and not go puff.
Please downconvert your VI to at least LabVIEW 2021 (better 2019, so others can also open the VI).
I think it is similar or idenbtical to the initial posting from VitSlaby. It is cause by recusion / stack overflow in PCRE. I have not checked PCRE2 in this regard, but that is probably not relevant here. The PCRE library has the nice option NO_RECURSE and this option is normally not enabled and PCRE uses recusion for backtracking.
If compiled with NO_RECUSE, the initial regex from VitSlaby works without crashing, so I think it is the same issue like yours.
03-12-2026 06:35 AM
I'm pretty sure it is recursive backtracking that crashes it, I just followed up as original post was on 32 bits mostly to point out that 64 bits LV is no different. And no, I'm not about to compile PCRE, and LV doesn't offer me that option.
Attaching 2019 version here.
03-12-2026 08:04 AM
I bet there's some option to limit or stop recursion. I don't know enough regexp.
03-12-2026 11:03 AM
Thanks for the downconverted VI.
It's an interessting situation, which forced me to look something deeper into it.
I just started to fix some minor bugs and move my very old PCRE library to 64 bit, so it's just a little step more to investigate this issue.
The problem is with the last regex: "(^([#;].*\n)*\[)", It works fine for several replacements until it comes to the line "# [XX xxxxxxx Xxxx]" of the input string. At that point the PCRE compiled with recursion enabled will crash. The version compiled without recursion works until the end of the input string.
Here is the complete source code in case anyone is interested in taking a closer look at the problem. My library does not implement search and replace, and I also find the implementation with $1, etc. in the replace string rather strange. That's why I have recreated it very quickly and dirty. Downconverted to LabVIEW 2018.