Skip to content

gsub breaks \b for checking word boundaries #1425

@thedward

Description

@thedward

When I run the following program with jq -n:

"hello world"|"\\b(?<i>[[:lower:]])" as $rx|gsub($rx;.i|ascii_upcase)

Expected Output:

"Hello World"

Actual Output:

"HELLO WORLD"

I've got a workaround for my particular use case:

"hello world"|"\\b(?<fst>[[:lower:]])(?<rst>[[:lower:]]*)\\b" as $rx|gsub($rx;"\(.fst|ascii_upcase)\(.rst)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions