# Searching for a regular expression inside an array

**URL:** https://discourse.julialang.org/t/searching-for-a-regular-expression-inside-an-array/16298
**Category:** New to Julia
**Created:** [October 14, 2018, 2:21am UTC](https://discourse.julialang.org/t/searching-for-a-regular-expression-inside-an-array/16298 "2018-10-14T02:21:23Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)
#### Post date: [October 14, 2018, 6:14am UTC](https://discourse.julialang.org/t/searching-for-a-regular-expression-inside-an-array/16298/6 "2018-10-14T06:14:14Z")

</div>

Thanks for the help. I am still having a lot of trouble.

- The method of mapping and matching outlined by @baggepinnen works for me on a 1x3 array, but it does not work on a 128x13 sized array.  
Here is my minimum working example for the latter. **How do I expand this to accommodate arrays of higher dimensionality?:**

```julia
a = ["fa" "so" "la"]
map(a) do str
    match(r"fa", str)
end

```

- I am trying to relate your coding suggestion to the [manual’s suggestion] in order to access more features related to the match function ([Strings · The Julia Language](https://docs.julialang.org/en/v0.6.2/manual/strings/))

. When I try to access these features, I can’t. I tried setting m = ans in the above MWE, and then trying the below things but that returned an error. **How do I access the value of the matched item so that I can use it later?**

- the entire substring matched: `m.match`
- the captured substrings as an array of strings: `m.captures`
- the offset at which the whole match begins: `m.offset`
- the offsets of the captured substrings as a vector: `m.offsets`

@bennedich, it later occurred to me that I can access the last element of the array for that particular task, but I am finding myself returning to this process of needing to search for specific strings again and again, like in the above MWE. I will upgrade to Julia 1.0 soon, but the problem is that I use VSCode and the two haven’t been made compatible yet.

Many thanks!

My ideal multidimensional looks like this by the way:  
000 C . Dbb B# do . ru ty S . sa .;  
100 C# Db . . di ra . . R1 . ri .;  
200 D . Ebb Cx re . mu dy R2 G1 ri ga;  
300 D# Eb . . ri me . . R3 G2 ri ga;  
400 E . Fb Dx mi . fu ry . G3 . ga;  
500 F . Gbb E# fa . su my M1 . ma .;  
600 F# Gb . . fi se . . M2 . ma .;  
700 G . Abb Fx so . lu fy P . pa .;  
800 G# Ab . . si le . . D1 . da .;  
900 A . Bbb Gx la . tu sy D2 N1 da ni;  
1000 A# Bb . . li te . . D3 N2 da ni;  
1100 B . Cb Ax ti . du ly . N3 . ni;

---

_[View the full topic](https://discourse.julialang.org/t/searching-for-a-regular-expression-inside-an-array/16298)._
