Skip to content

Comments

Add foldcase lookahead example#4785

Open
librasteve wants to merge 3 commits intomainfrom
librasteve-foldcase
Open

Add foldcase lookahead example#4785
librasteve wants to merge 3 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.

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