# Help converting python to julia?

**URL:** https://discourse.julialang.org/t/help-converting-python-to-julia/31998
**Category:** New to Julia
**Tags:** strings, regex
**Created:** [December 8, 2019, 4:10am UTC](https://discourse.julialang.org/t/help-converting-python-to-julia/31998 "2019-12-08T04:10:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PseudoCodeNerd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pseudocodenerd/32/11948_2.png) [@PseudoCodeNerd](https://discourse.julialang.org/u/PseudoCodeNerd)
#### Post date: [December 8, 2019, 4:10am UTC](https://discourse.julialang.org/t/help-converting-python-to-julia/31998/1 "2019-12-08T04:10:16Z")

</div>

Hello There,  
after my previous post I tried learning ReGeX to do the acronym thing I was trying to do.  
I was able to write a python code for the same which works right !  
Julia documentation was not clear to me…

Can you please help me ?

```julia
import re
def abbreviate(words):
    regex = "[A-Z]+['a-z]*|['a-z]+"
    return ''.join(word[0].upper() for word in re.findall(regex, words))

```

P.S: I’m a 15 year old and this the first time I’m doing Julia and RegEx

---

<div class="post-metadata">

### Author: ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)
#### Post date: [December 8, 2019, 4:43am UTC](https://discourse.julialang.org/t/help-converting-python-to-julia/31998/2 "2019-12-08T04:43:59Z")

</div>

1. for `re.findall`, search `julia regex findall`, check the first link is [Find the index of all regex matches in Julia? - Stack Overflow](https://stackoverflow.com/questions/41724107/find-the-index-of-all-regex-matches-in-julia) . Take care that all matched stuffs are in type `RegexMatch`, you should use `matched.match` to get the exact matched string.

2. for `str.upper`, you can type `upper` in Julia shell, and press TAB, to check if any available similar stuffs. Absolutely you’ll get

3. `word[0]` shall be `word.match[1]`, you know Julia uses usually 1-based index?

4. `''.join`, search `julia join strings`, and the 3rd result listed several titled links from Stack Overflow, I found this:

So,

```julia
function abbreviate(words)
     regex = "[A-Z]+['a-z]*|['a-z]+"
     return join([uppercase(word.match[1]) for word in eachmatch(Regex(regex), words)], "")
end

```

---

<div class="post-metadata">

### Author: ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)
#### Post date: [December 8, 2019, 4:46am UTC](https://discourse.julialang.org/t/help-converting-python-to-julia/31998/3 "2019-12-08T04:46:00Z")

</div>

As you’re a very young person who just started learning about Julia, I’d give you such suggestions and methods to work with programming issues, instead of giving you the direct result.
