Skip to content

TypeError when matching SubString of StringView with Regex #26

Closed
@DatName

Description

@DatName

When using @view of StringView to match against some regex, I get an error

TypeError: in typeassert, expected SubString{SubString{StringView{Base.CodeUnits{UInt8, String}}}}, got a value of type SubString{StringView{Base.CodeUnits{UInt8, String}}}

Error comes from return type assert in convert(::Type{SubString{S}}, s::AbstractString) which is in julia' base.

MRE:

using StringViews
str_view = StringView("123-456")
match(r"(?<group>.*)", @view str_view[1:3])

Package version:

(@v1.10) pkg> st StringViews
Status `~/.julia/environments/v1.10/Project.toml`
  [354b36f9] StringViews v1.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions