Closed
Description
openedon Feb 25, 2018
I wrote this simple regex to grab words (with possible fancy characters)
for m in eachmatch(r"(\p{L}+)", "testing you")
@show m
end
m = RegexMatch("testing", 1="testing")
m = RegexMatch("you", 1="you")
seems to work:
prompt="¿Cuál es tu pregunta?"
"¿Cuál es tu pregunta?"
Main> for m in eachmatch(r"(\p{L}+)", prompt)
@show m
end
m = RegexMatch("Cuál", 1="Cuál")
m = RegexMatch("es", 1="es")
m = RegexMatch("tu", 1="tu")
m = RegexMatch("pregunta", 1="pregunta")
but it doesn't????
prompt = "Tú lees."
for m in eachmatch(r"(\p{L}+)", prompt)
@show m
end
ERROR: ArgumentError: invalid SubString index
Stacktrace:
[1] SubString{String}(::String, ::Int64, ::Int64) at .\strings\types.jl:17
[2] match(::Regex, ::String, ::Int64, ::UInt32) at .\regex.jl:166
[3] next(::Base.RegexMatchIterator, ::RegexMatch) at .\regex.jl:343
[4] anonymous at .\<missing>:?
[5] eval(::Module, ::Any) at .\boot.jl:235
end
(warning infinite loop): if you try
prompt = "Tú"
for m in eachmatch(r"(\p{L}+)", prompt)
@show m
end
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
m = RegexMatch("", 1="")
......................
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment