Skip to content

Add foldcase lookahead example#4785

Merged
librasteve merged 7 commits intomainfrom
librasteve-foldcase
Feb 23, 2026
Merged

Add foldcase lookahead example#4785
librasteve merged 7 commits intomainfrom
librasteve-foldcase

Conversation

@librasteve
Copy link
Contributor

From a recent thread on IRC/Discord https://discord.com/channels/538407879980482560/633753286209699870/1474676849329180682

The problem

ignorecase has some issues with Unicode comparisons

Solution provided

state the issue and suggest a more general solution with example using foldcase

@jubilatious1
Copy link
Collaborator

Pre-existing solutions:

~ % raku -e 'say "XßX".fc.match(/ :i ss /);'
「ss」

and:

~ % raku -e 'say "XßX".fc.match(/  ss /);'
「ss」

@coke coke self-requested a review February 21, 2026 16:36
@librasteve
Copy link
Contributor Author

librasteve commented Feb 21, 2026

Oh I see there’s a failing test - I will try to fix shortly.

@jubilatious1 thanks for the tips regarding match, on IRC/Discord, one aspect was how to do the fold case for just part of a string. So I’m proposing this Regex example here in the Regex section. :-)

@librasteve
Copy link
Contributor Author

Removed trailing whitespace - hopefully this will now pass checks.

@coke
Copy link
Collaborator

coke commented Feb 22, 2026

    # Failed test 'X<Ignoremark|Adverbs,:ignoremark;Adverbs,:m> must not contain multiple indexes in one X<>'
    # at t/18-rakuast-validate.rakutest line 61
    # You failed 1 test of 738

I just went through a big PR to eliminate all the doubled X<>s - this seems to be a reversion of the change I made on this header in my PR.

=begin code
say so "STRASSE" ~~ /(\w+) <?{$0.fc eq "straße".fc}>/ # OUTPUT: «True␤»
=end code

Copy link
Collaborator

Choose a reason for hiding this comment

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

Has trailing whitespace, failing test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Slight preference to use single quotes here since nothing needs interpolation.

say so "STRASSE" ~~ /(\w+) <?{$0.fc eq "straße".fc}>/ # OUTPUT: «True␤»
=end code

=head3 X<Ignoremark|Adverbs,:ignoremark;Adverbs,:m>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I also edited this line in my recently merged PR, please update to match.

@librasteve
Copy link
Contributor Author

hi - I have made the requested changes - again here via the GH web interface file edit (since that was the way I made the initial change - apologies that this is a merge not a rebase. tbh I need to learn the difference as squishing commits has not been a thing for my work so far.

@librasteve
Copy link
Contributor Author

Oh, got a new failing test

X<Ignoremark|Adverbs,:ignoremark;Adverbs,:m> must not contain multiple indexes in one X<>

@librasteve librasteve merged commit d7cf7c1 into main Feb 23, 2026
1 check passed
@FCO
Copy link

FCO commented Feb 23, 2026

Could the link be using the irc logs?

@librasteve
Copy link
Contributor Author

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.

4 participants