# Questions about string

**URL:** <https://discourse.julialang.org/t/questions-about-string/88604>\
**Category:** New to Julia\
**Tags:** question, strings, regex\
**Created:** [October 12, 2022, 3:51am UTC](https://discourse.julialang.org/t/questions-about-string/88604 "2022-10-12T03:51:49Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [January 16, 2023, 12:27pm UTC](https://discourse.julialang.org/t/questions-about-string/88604/22 "2023-01-16T12:27:35Z")

</div>

> [@rocco\_sprmnt21](#):
>
> `codebreaker(s,"Freya")`

Amazing, now I need to learn about Word2Vec and NLP in Julia after this

---

<div class="post-metadata">

**Author:** ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Post date:** [January 16, 2023, 8:23pm UTC](https://discourse.julialang.org/t/questions-about-string/88604/23 "2023-01-16T20:23:06Z")

</div>

Consider using (studying) this solution (of @rafael.guerra) which is surely more flexible than mine (built only on a for loop) and also very efficient.

```julia
function numberstrip3(c, pattern)
    d = split(c, pattern)
    pop!(d)
    v = filter(!isempty, d)
    ix = findlast.(!isdigit, v)
    s = Int[]
    for (i,u) in zip(ix,v)
        if isnothing(i)
            push!(s, parse(Int,u))
        else
            x = tryparse(Int, u[i+1:end])
            !isnothing(x) && push!(s, x)
        end
    end
    return s
end

```

[Previous page](https://discourse.julialang.org/t/questions-about-string/88604.md?page=1)
