Finish line
Tags: javascript, opensource, beginners
Published: 2021-12-11 02:00:22

## Hey,
This is the final post of my trilogy; the other 2 you can read here:
[How it started](https://dev.to/gmotgit/release-04-implementing-a-feature-3j5p)
[How it was going](https://dev.to/gmotgit/update-on-release-04-582j)

--- 

## Continuing 
It has been only few days since my last blog, but in this short time I was able to produce an acceptable result that would suffice the feature implementation desired on the [issue](https://github.com/GitSparTV/lua-patterns/issues/3).

Because I used vanilla JavaScript, some ideas that I had could not be implemented like displaying HTML in an input tag, so I had to come around and work with what I had.

--- 

## How I did it
As I said before, the way I did it was very simple.

 ![howitwork](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5fx1rmv4ppsucozcswg.png)
 
Get value from input field, parse it, and give the parsed string to a p tag.

For each character on the input value, a series of checks were made. If the character passed the check, then a span with a certain class were added to it.

Looks simple right?
But when a `%` can mean something and `%1` can mean something else it starts to get more interesting.
Now imaging parsing this:
```
^^charsq+w-e*r?.%.(%a%c%d%g%l%p%s%u%w%x%z%A)[asd]%f[^not]%1%b{}[%]a-z]$$
```
Of course, that to be able to solve it and understand the priority of each character, I had to learn how to Lua Script RegEx worked.

--- 

## The Results

The result worked well, here is a screenshot of the result: 

 ![result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygp3o25mbisxc9irqxv6.png)
 

--- 

##What I Learned
I thought I knew a little bit of JS… but when you have no access to `npm modules` and need to create your own algorithms with limited time you can see that even JS goes way deeper than you think.

First, I was using `map` to change each character of my array. Then I decided to mix it with `shift()`, and started to have some very interesting results, which I cannot fully understand to be honest.

It was working perfect, with exception that the character at the end of my string was disappearing in the way.
And why? I don’t know too :D

When I needed to remove the first character, I used shift. But sometimes it was also not needed, and again I don’t know why.
So I decided to stop trying making something complex which would look good to make something simpler, but that worked fine.

You don’t need to be a programmer to understand that a man gave up here:

![fail]( https://media4.giphy.com/media/6C98WziGS8KfZN2Nnu/giphy.gif?cid=790b7611240122f004d331b15ba2ab7389f7b7fbab3a978a&rid=giphy.gif&ct=g)
But I think this will happen a lot, code that work but I’m not sure why.

--- 

## Conclusion
This PR was a lesson of humility to be honest, and what looked like an easy task took me so long and made me see that I don’t fully understand JS, not even basic functions.

And to be honest, it felt pretty good. For sure I am going back to this code to understand it better and learn what was going wrong 
with my first attempt.

![yodinhazicamemo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4l0dgb140mptjbpqkx96.jpg)
 

I hope you have enjoyed reading this,
See you