Skip to content

Fix label matching in GetLineToWrite to avoid false matches in filenames#54

Open
TnR2 wants to merge 1 commit into
OpenFAST:mainfrom
TnR2:main
Open

Fix label matching in GetLineToWrite to avoid false matches in filenames#54
TnR2 wants to merge 1 commit into
OpenFAST:mainfrom
TnR2:main

Conversation

@TnR2

@TnR2 TnR2 commented Jun 19, 2026

Copy link
Copy Markdown

Description:

Use regex with <...> word boundaries instead of simple strfind to locate parameter labels as independent fields. This prevents incorrect matching when a label string appears inside a quoted filename.

If the regex pattern fails to match, falls back to the original strfind result.

Example:

Before (incorrect matching):
Template line:
"IEA-10.0-198-RWT_InflowFile.dat" InflowFile - Name of file containing...

strfind matches "InflowFile" inside the filename first, resulting in:
"OF_WT_InflowFile.dat" InflowFile.dat" InflowFile - Name of file...

After (correct matching):
regex <...> matches only the standalone "InflowFile" label, resulting in:
"OF_WT_InflowFile.dat" InflowFile - Name of file containing...

Use regex with \<...\> word boundaries instead of simple strfind to locate parameter labels as independent fields. This prevents incorrect matching when a label string appears inside a quoted filename.

If the regex pattern fails to match, falls back to the original strfind result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant