Skip to content

Conversation

@OAbubakr
Copy link

Fix exclusion reason parsing and improve apostrophe handling

Problem

After implementing complex regex patterns to handle commas in exclusion reasons, single exclusion reasons like "a, 1" were incorrectly displaying as "(n=a)" instead of "a (n=1)". Additionally, apostrophes were being escaped as \' which displayed incorrectly in the final output.

Root Cause

  • Complex regex patterns: The new patterns ",\\s*\\d+\\s*$" and "^.*,\\s*(\\d+)\\s*$" were too strict and failed for simple single exclusion cases
  • Apostrophe escaping: Using \' escape sequence caused display issues where apostrophes appeared as backslash-quote combinations

Solution

1. Reverted to original parsing logic

  • Reason extraction: Reverted to ",.*$" - removes everything after first comma
  • Number extraction: Reverted to ".*," - removes everything before last comma
  • This simple approach correctly handles both single and multiple exclusion reasons

2. Improved apostrophe escaping

  • Changed apostrophe escaping from \' to HTML entity '
  • Preserves apostrophe appearance in final display while preventing DOT syntax errors
  • Removed unnecessary backslash escaping that was causing issues

@OAbubakr
Copy link
Author

Screenshot from 2025-11-19 09-17-22 Screenshot from 2025-11-19 09-17-10

@OAbubakr OAbubakr changed the title fix: Revert exclusion reason parsing to original logic and improve ap… fix: Revert exclusion reason parsing to original logic Nov 19, 2025
@OAbubakr OAbubakr merged commit e7cb732 into rayyan Nov 19, 2025
11 checks passed
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.

3 participants