Skip to content

Allow searching for number-number on two lines #19324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

nicolo-ribaudo
Copy link
Contributor

When a dash separates two digits, it's very likely to not be a hyphen inserted to split a word into two lines (e.g. "par\n-ser"), but rather either a minus sign, a range, or a date. For example, in the tracemonkey PDF there is 2008-02 (a date) split across two lines.

Preserving the dash, similarly to how we do for compound words, allows searches for "2008-02" to find a match.

I was originally going for a more complex regexp that checks for "letter"+"diacritics"+"dash"+"newline"+"letter", but if there are diacritics it's already very likely that they are preceded by a letter so the existing (\\p{M}+(?:-\\n)?) is good enough.

When a dash separates two digits, it's very likely to not be a hyphen
inserted to split a word into two lines (e.g. "par\n-ser"), but rather
either a minus sign, a range, or a date. For example, in the tracemonkey
PDF there is `2008-02` (a date) split across two lines.

Preserving the dash, similarly to how we do for compound words, allows
searches for "2008-02" to find a match.
@Snuffleupagus
Copy link
Collaborator

/botio unittest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/4491bd3f7e08e1d/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/b332744a1d3841d/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/b332744a1d3841d/output.txt

Total script time: 2.36 mins

  • Unit Tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/4491bd3f7e08e1d/output.txt

Total script time: 6.95 mins

  • Unit Tests: Passed

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, thank you.

@Snuffleupagus Snuffleupagus merged commit 711bf2b into mozilla:master Jan 15, 2025
7 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the search-dash-date branch January 15, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants